yolov3 training (6) darknet training and testing


###############################################
Students, don’t just follow me to operate this series of files, because This is a record of stepping on pits, not a tutorial. I just recorded the whole process, so that students in the future can avoid these pits when operating. I hope you can read the entire series of operation processes and then operate after consideration
### #################################

When the process of the previous rounds is completed, the training can start

Monitor the GPU in real time every 0.5 seconds, and you can see the current GPU usage

watch -n 0.5 nvidia-smi

insert image description here
to train

./darknet detector train cfg/voc.data cfg/yolov3-voc.cfg yolov4.conv.137  >>  /home/heying/darknet/scripts/VOCdevkit/VOC2021/traffic_light.log

Among them,
this line of instructions can be simplified to
./darknet detector train [.data] [.cfg] [.weight]
[cfg/voc.data]->[.data]: refers to the .data file path just configured
[cfg/yolov3 -voc.cfg]->[.cfg]: refers to the .cfg file path just configured
[darknet53.conv.74]->[.weight]: is the path of the pre-training weight file, which can be a .weight file or It is a .backup file. If it is the same project here, the second training can use the model file generated by the first training
[>> /home/heying/darknet/scripts/VOCdevkit/VOC2021/traffic_light.log] will The standard output of the terminal is written to the specified traffic_light.log file, which only records all the standard output when the terminal is running, that is, the record of the training process, which is convenient for subsequent viewing. Non-essential

successfully started training
insert image description here

After about 6 hours of waiting, the training is complete. You can see the model training collapsed graph generated in the directory darknet
insert image description here

Then in the output log log file, you can see that 5000 trainings have been completed
insert image description here

When the training is complete,
you can first check the recognition effect of the generated model
First connect the camera to the running host

List the port numbers of all the cameras connected to the current system
ls /dev/video*
insert image description here
When there is a port number output, it indicates that the camera is connected successfully. I use [/dev/video4] port here.
What? You asked me why there are so many port numbers and how many cameras are connected. In fact, here I am using Intel's D435I depth camera
insert image description here

Move to the darknet directory

cd darknet/


Use the model generated by training for camera recognition

./darknet detector demo cfg/voc.data cfg/yolov3-voc.cfg backup/yolov3-voc_5000.weights /dev/video4

insert image description here

Where
[./darknet detector demo] uses the camera for real-time detection
[cfg/voc.data] the data file path used during training
[cfg/yolov3-voc.cfg] the cfg configuration file path used during training
[backup/yolov3-voc_5000.weights] specifies the recognition model used, here we use the traffic light recognition model file generated by training [
/dev/video4] specifies the port number of the camera, which represents the data source of the camera

You can see that the data has been recognized.
insert image description here
You can also move it at this time, and replace it with a green light to see the effect of recognition.
insert image description here

The output of the terminal during the identification process
insert image description here

Guess you like

Origin blog.csdn.net/Xiong2840/article/details/127937805