-
環(huán)境配置:
硬件:GPU、CPU
軟件:Ubuntu蛮穿、TensorFlow-GPU版本筐眷、Seaborn澳眷、Matplotlib
要求:TF的版本對GPU有版本匹配要求
tips:
# 命令行查看GPU使用情況 watch -n 10 nvidia-sim # 10秒 刷新一次唠粥, nvidia-sim
AWS學(xué)術(shù)服務(wù)器的申請和使用技巧疏魏。
-
建模流程:
- 選擇神經(jīng)網(wǎng)絡(luò)框架:Keras、TensorFlow晤愧、Pytorch...
- 根據(jù)所選的框架大莫,處理現(xiàn)有數(shù)據(jù),以適配框架數(shù)據(jù)類型官份。巧用panda只厘、sklearn對數(shù)據(jù)集進(jìn)行讀取(read_scv)舅巷、分配(train_test_split)羔味、缺失值處理,用seaborn钠右、matplotlib對數(shù)據(jù)可視化赋元,輔助直覺判斷。
- 建立模型
- 模型性能評估
- 特別糾錯(cuò)
- 使用模型預(yù)測并生成結(jié)果
-
開發(fā)Tip:
- 巧用lib:sklearn飒房、seaborn搁凸、matplotlib、panda
Useful QA:
-
Q: Just one small question why do you take batch_size to be 86 ? Is it just random value or does it changes something to the result ?
A: It would be really interesting to hear from author about this. But I believe you will be able to get pretty the same results if you choose 64 or 32 or 128 as batch size. And may be it will be even run faster because of CPU optimizations...
A: Batch size is mainly a constraint on your own computer. The larger the batch size, the more data your chunking into your memory that your model will train on. The small the batch size, the less data, but your computation will be slower.
It's a tradeoff between speed and memory.
-
Q: in my first try I use:
In -> [ Conv2D (3,3) -> relu -> MaxPool2D ]*2 -> Conv2D (3,3) -> relu -> MaxPool2D --> Flatten -> Dense -> Dropout -> Out
(I've got a good accuracy in cat&dogs competition with this architecture) and the accuracy was 0.95
How can we know a good architecture of the CNN for any type of problem?
A: There are many Convolution neural networks models proposed in many papers . Every model gives better accuracy than the one before it . that is Alex net performs better than lenet and googLeNet is better than AlexNet but in general with some error analysis and trials you should find the number of layers and the architecture that will fit the task
Q: So, when you face one new image problem, how do beginners start their neural network? Any suggestions for a starting architecture? Thanks
A: You may try to find a paper or an algorithm that was proven to work well for similar tasks. you then try to modify it to fit your task according to the results you get from the algorithm. You may also consider not to reinvent the wheel by implementing the algorithm from scratch, Instead you may use one of well known algorithm used in ImageNet or other challenges like VGG-16 , VGG-19 or yolo depending on the Task. Transfer learning makes it easier for the training process as the algorithm will be pre-trained but you will have to decide how many layers you want to freeze according to the training data you have.
-
Q:
- Accuracy seems to be lower than validation accuracy. Is this due to the fact that training data is augmented and thus harder to identify than validation data?
- You chose
In -> [[Conv2D->relu]*2 -> MaxPool2D -> Dropout]*2 -> Flatten -> Dense -> Dropout -> Out
as your CNN structure. Could you provide some reasoning for laying 2 Conv2D layers before max pooling? Why is this structure better thanIn -> [ Conv2D-> relu -> MaxPool2D -> Dropout]*2 -> Flatten -> Dense -> Dropout -> Out
A:
- Yes exaclty !
? 2) This dataset is composed of digits images of the same small size. Images are somewhat aleardy normalized. So we are facing an easy problem. No need of very deep networks.
It is better to add consecutively Conv+relu layers followed by maxpool layer. With this technique you increase exponentially the number of filters. Take a look at Google LeNet or VGG16/19 network , they are very deep networks but very well build to better extract features from images.