Giter Club home page Giter Club logo

traffic-signal-detect's Introduction

目录说明:

1. data/TSD-Signal目录需要放入图片文件夹,用来生成record文件,输出到data/records  
2. data/TSD-Signal-GT目录需要放入图片标记的xml文件,用来生成record文件  
3. data/test_samples目录需要放入图片文件夹,inference.py生成带标记框的测试结果用。  

使用说明:

注:   
    1. 下面所有脚本都在src目录下运行。(src/scripts目录下的脚本是工具脚本,可以单独执行)  
        在src路径下设置环境变量:  
            protoc object_detection/protos/*.proto --python_out=.
            export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/object_detection/slim
            
    2. models/research/object_detection这个文件夹复制到了src目录下,并将一部分必要的文件也复制到了这个目录. 因此本项目可以放到任意地方。   
    3. 如果模型不一样,下面的名称需要更改。 路径一般不用更改,都是相对路径。  

1. xml转换为record:
        python ./create_fc_record.py
        
2. 运行train.p训练模型:  

    python train.py --logtostderr \
    --pipeline_config_path=../config/ssd_mobilenet_v1.config \
    --train_dir=./model_cpkt
    
3. 将模型转为pb文件:  
    需要将 *./model_cpkt/model.ckpt-0* 更改为要转换的ckpt文件
      
    CUDA_VISIBLE_DEVICES="1" python ./object_detection/export_inference_graph.py   \
    --input_type image_tensor     \
    --pipeline_config_path ../config/ssd_mobilenet_v1.config  \
    --trained_checkpoint_prefix ./model_cpkt/model.ckpt-0     \
    --output_directory ./model_pb/
    
4. 运行inference.py测试模型结果,得到带标注框的图片。
    python inference.py

5. 运行eval.py进行验证:   
    python eval.py     --logtostderr     \
    --pipeline_config_path=../config/ssd_mobilenet_v1.config   \
    --checkpoint_dir=model_cpkt     \
    --eval_dir=./model_cpkt/eval_log
    
6. Tensorboard可视化log:  
    查看训练log:
        tensorboard --logdir ./model_cpkt/  
    查看验证log:
        tensorboard --logdir ./model_cpkt/eval_log/  
    同时查看2种log:
        tensorboard --logdir .

模型配置文件更改:

注:   
    1. 如果使用新的模型,只需要更改fine_tune_checkpoint   
    2. 模型配置文件在./config/目录下   

1. 分类个数:
    num_classes: 77
    
2. 模型路径:   
    fine_tune_checkpoint: "./object_detection/checkpoints/ssd_mobilenet_v1_coco_2017_11_08/model.ckpt"    
    
3. 训练次数:  
    num_steps: 20000  
    
4. train input路径:  
   train_input_reader: {  
      tf_record_input_reader {  
        input_path: "../data/records/train.record"  
      }  
      label_map_path: "../config/traffic.pbtxt"  
    }  

5. eval路径:  
    eval_input_reader: {
      tf_record_input_reader {
        input_path: "../data/records/val.record"
      }
      label_map_path: "../data/traffic.pbtxt"
      shuffle: false
      num_readers: 1
    }

traffic-signal-detect's People

Contributors

cabbagehao avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.