列举了几种常用写法,深度学习各种模型常用3中方法,
#1: VIS/ |-- bin/ | |-- vis | |-- vis/ | |-- tests/ | | |-- __init__.py | | |-- test_main.py | | | |-- __init__.py | |-- main.py | |-- docs/ | |-- conf.py | |-- config.json | |-- setup.py |-- requirements.txt |-- README #2. VIS/ |-- src/ | |-- util/ | | |-- __init__.py | | |-- process.py | | |-- frame2video.py | | | |-- __init__.py | |-- main.py | |-- cfg/ | |-- config.json | |-- setup.py |-- requirements.txt |-- README #3.深度学习常用 ├─caffe-fast-rcnn ├─data │ ├─demo │ └─scripts ├─experiments │ ├─cfgs │ ├─logs │ └─scripts ├─lib │ ├─datasets │ │ ├─tools │ │ └─VOCdevkit-matlab-wrapper │ ├─fast_rcnn │ ├─nms │ ├─pycocotools │ ├─roi_data_layer │ ├─rpn │ ├─transform │ └─utils ├─models │ ├─coco │ │ ├─VGG16 │ │ │ ├─faster_rcnn_end2end │ │ │ └─fast_rcnn │ │ └─VGG_CNN_M_1024 │ │ ├─faster_rcnn_end2end │ │ └─fast_rcnn │ └─pascal_voc │ ├─VGG16 │ │ ├─faster_rcnn_alt_opt │ │ ├─faster_rcnn_end2end │ │ └─fast_rcnn │ ├─VGG_CNN_M_1024 │ │ ├─faster_rcnn_alt_opt │ │ ├─faster_rcnn_end2end │ │ └─fast_rcnn │ └─ZF │ ├─faster_rcnn_alt_opt │ ├─faster_rcnn_end2end │ └─fast_rcnn └─tools1.默认python路径声明
第一行大部分python文件的头部都会写上 #!/usr/bin/python 或者 #!/usr/bin/env
#!/usr/bin/env python
普通运行模式例如(linux) : python .py 第一行语句无效。
可执行模式:./.py (文件要有可执行权限chmod a+x *.py),第一行语句为脚本语言指定解释器。
注:
#!/usr/bin/env python 是找系统 PATH 中指定的第一个 python 来执行你的脚本,比如虚拟环境设为第一个。
#!/usr/bin/python 是找系统默认 python 环境,但是大家普遍不爱用默认的。
第二行一般设置编码
# _*_ coding:utf-8 _*_
- 如果没有此文件编码类型的声明,则 python 默认以ASCII编码去处理;如果你没声明编码,但是文件中又包含非ASCII编码的字符的话,python解析器去解析的 python 文件就会报错。
- 必须放在python文件的第一行或第二行;
- 支持的格式有三种:(一般用2)
# coding=3.版权声明最常见的,带冒号的(大多数编辑器都可以正确识别的): #!/usr/bin/python # -*- coding: -*- vim的: #!/usr/bin/python # vim: set fileencoding= :
以下是几个实例,来自github等
#1 *Copyright: Copyright (c) 2017 *Created on 2019-6-6 *Author: kobe *Version 1.0 *Title: a simple implement of faster-rcnn #2. #3. # -------------------------------------------------------- # Fast R-CNN # Copyright (c) 2015 Microsoft # Licensed under The MIT License [see LICENSE for details] # Written by Ross Girshick # -------------------------------------------------------- #4. # -------------------------------------------------------- # Pytorch multi-GPU Faster R-CNN # Licensed under The MIT License [see LICENSE for details] # Written by Jiasen Lu, Jianwei Yang, based on code from Ross Girshick # --------------------------------------------------------4.编码风格
命名规范: https://www.cnblogs.com/Maker-Liu/p/5528213.html
Google python风格: https://zh-google-styleguide.readthedocs.io/en/latest/google-cpp-styleguide/comments/



