The whole process of configuring SSD network under ubuntu

       The Single Shot Detector (SSD) was  proposed  by  Wei Liu of UNC Chapel Hill (University of North Carolina at Chapel Hill)  on the ECCV in 2016. The title of the paper is "SSD: Single Shot MultiBox Detector", the project code address: https:// github.com/weiliu89/caffe/tree/ssd

        There are detailed configuration and operation steps in the URL. Here is a simple arrangement. My environment is ubuntu 16.04 LTS, graphics card GTX 760. There have been some problems in the middle, but they have been basically solved through Baidu, and possible problems and solutions will be given later. :

      (1) Installation

         Assuming you downloaded the source code and unzipped it to the folder $ caffe-ssd , note that $ caffe-ssd is the absolute path to your caffe-ssd , which varies from person to person , execute the following commands in sequence:

         #Go to the folder of your source code, it varies from person to person

          cd  $ caffe-ssd

          #Modify Makefile.config according  to  your Caffe installation.

          cp Makefile.config.example Makefile.config

          make -j8

          #This is very important, is to add $ caffe-ssd /python path to PYTHONPATH

          #Note that it needs to be added permanently, otherwise the setting will be invalid after you restart next time. The reference method is as follows:

          #Enter the following command in the ubuntu terminal

          gedit /etc/profile

          #Add the following line of code after the opened file, pay special attention that $ caffe-ssd is the absolute path of your caffe-ssd , which varies from person to person:

          export PYTHONPATH=$caffe-ssd/python:$PYTHONPATH

          #Then enter the following command in the ubuntu terminal, the purpose is to make the modification take effect immediately without restarting the computer

          source /etc/profile

#Then go back to the $ caffe-ssd directory           under the ubuntu terminal and execute the following command:

          make py

          make test -j8

          #The following command is optional

          make runtest -j8

       (2) Preparation

        1. Download VGGNet, address: fully convolutional reduced (atrous) VGGNet , if the download address is not accessible, go to the top source website to download, it is easier to find, assuming you store it in the directory $ caffe-ssd /models/VGGNet .

2. Download the VOC2007 and VOC2012 datasets, which are stored in $ HOME/data/ by          default . This is particularly important . I did not store them here, so the following step (3) is not very convenient. The path is modified in the script file, so it is recommended to exist under the default $ HOME/data/ , which is also easier to find.

         # Download compressed package data

        cd $HOME/data

        wget http://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCtrainval_11-May-2012.tar

        wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtrainval_06-Nov-2007.tar

        wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtest_06-Nov-2007.tar

        # decompress data

        tar -xvf VOCtrainval_11-May-2012.tar

        tar -xvf VOCtrainval_06-Nov-2007.tar

        tar -xvf VOCtest_06-Nov-2007.tar

     (3) Create LMDB file

       cd $ caffe-ssd

       #Create trainval.txt, test.txt and test_name_size.txt under data/VOC0712

       ./data/VOC0712/create_list.sh

      ./data/VOC0712/create_data.sh

     (4) Training and validation

       # It will create model definition files and save snapshot models in:

       #   - $CAFFE_ROOT/models/VGGNet/VOC0712/SSD_300x300/

       # and job file, log file, and the python script in:

       #   - $CAFFE_ROOT/jobs/VGGNet/VOC0712/SSD_300x300/

       # and save temporary evaluation results in:

       #   - $HOME/data/VOCdevkit/results/VOC2007/SSD_300x300/

       # It should reach 77.* mAP at 120k iterations.  

       #If you just want to see the effect of SSD, the following command can not be executed first

       python examples/ssd/ssd_pascal.py

       # Of course, there may be some problems with the above command. You must learn to read errors, find the earliest error report, and then solve them one by one. Generally speaking, most of the problems you encounter can be found online. What you need is to organize them well. in your language, and then Baidu search , such as:

       1. Can't find "VGG_ILSVRC_16_layers_fc_reduced.caffemodel", download the address VGG_ILSVRC_16_layers_fc_reduced.caffemodel and put it in your $ caffe-ssd /models/VGGNet directory.

       2. Report an error like "Check failed: error == cudaSuccess (10 vs. 0) invalid device ordinal"

        Solution: Change the GPU selection of gpus = "0, 1, 2, 3" in line 332 of the ssd_pascal.py file to gpus = "0", and delete the following 1, 2, and 3. Just train again.

       3. Report an error like "Check failed: error == cudaSuccess (2 vs. 0) invalid ..."

          Solution: Change the batch_size=32 and accum_batch_size=32 in the 338th line of the ssd_pascal.py file to double or double the size. I changed it to batch_size=8 and accum_batch_size=8. It seems to be able to run, otherwise an error will be reported.

        If you don't have time to train, you can download the pre-trained model from the source code page, address:

        If you want to test your trained model

        python example/ssd/score_ssd_pascal.py

        If there is no problem with the above, you can test it through the webcam or existing video.

        # webcam

        python examples/ssd/ssd_pascal_webcam.py

       The effect is as follows (taken by the laboratory's own camera):

       

       # Existing video

       python examples/ssd/ssd_pascal_video.py

       The effect is as follows:

       


      Of course, this is only a general introduction. For details, please refer to the website given by the source code. I'm just a rookie. I tried to configure it myself and played it. After that, I also configured yolo3, which is also relatively easy to configure. If you are interested, you can try it. Address: https://github.com/pjreddie/darknet

       For installation steps, please refer to the second line at the bottom of the above URL, which contains detailed operation steps.



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326221286&siteId=291194637
Recommended