深度学习 建模流程总结

  1. 环境配置:

    硬件:GPU、CPU

    软件:Ubuntu、TensorFlow-GPU版本、Seaborn、Matplotlib

    要求:TF的版本对GPU有版本匹配要求

    tips:

    # 命令行查看GPU使用情况
    watch -n 10 nvidia-sim
    # 10秒 刷新一次,
    nvidia-sim
    

    AWS学术服务器的申请和使用技巧。

  2. 建模流程:

    1. 选择神经网络框架:Keras、TensorFlow、Pytorch...
    2. 根据所选的框架,处理现有数据,以适配框架数据类型。巧用panda、sklearn对数据集进行读取(read_scv)、分配(train_test_split)、缺失值处理,用seaborn、matplotlib对数据可视化,辅助直觉判断。
    3. 建立模型
    4. 模型性能评估
    5. 特别纠错
    6. 使用模型预测并生成结果
  3. 开发Tip:

    1. 巧用lib:sklearn、seaborn、matplotlib、panda

Useful QA:

  1. 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.

  2. 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.

  3. Q:

    1. 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?
    2. 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 than In -> [ Conv2D-> relu -> MaxPool2D -> Dropout]*2 -> Flatten -> Dense -> Dropout -> Out

    A:

    1. 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.

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 202,607评论 5 476
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 85,047评论 2 379
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 149,496评论 0 335
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,405评论 1 273
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,400评论 5 364
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,479评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,883评论 3 395
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,535评论 0 256
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,743评论 1 295
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,544评论 2 319
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,612评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,309评论 4 318
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,881评论 3 306
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,891评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,136评论 1 259
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 42,783评论 2 349
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,316评论 2 342

推荐阅读更多精彩内容