Abstract: Through the classification training of basketball action and the explanation and experience of identification and detection examples, we understand the basic knowledge of Yolov3 model, such as the principle and structure, and lay a foundation for future in-depth study.

Backed by a new design concept, Huawei Cloud launched the MindSpore Deep Learning training camp, to help Xiaobai quickly pick up the high-performance deep learning framework, quickly train ResNET-50, achieve your first mobile App development, learn intelligent news classification, basketball detection and “guess you like” model!

MindSpore Deep Learning Training camp, through 21 days of reasonable course arrangement, not only provides the current hot mobile deployment introduction, but also interesting practice to keep up with current events, and more in-depth explanation of low-level development, so that you can learn everything from framework to algorithm to development.

In the fourth class of the 21-day actual combat camp, Mr. Wang shared the realization of Yolov3 in image classification, target detection and other aspects. Through the classification training of basketball actions and the explanation and experience of identification and detection examples, I have understood the basic knowledge of Yolov3 model, such as principle and structure, laying a foundation for further study in the future.

This experience is also based on ModelArts+OBS. The basic operation steps will not be described here. You can refer to the previous article. Homework is also divided into experience homework and advanced homework.

Experience homework: input basketball game pictures and complete model reasoning process in ModelArts environment. The code and steps provided in this tutorial are relatively easy to implement and will not be highlighted here.

Advanced homework: Input basketball game video and complete model reasoning process in ModelArts environment. The specific implementation steps are as follows:

1, download a video of the basketball game, the best format is MP4, AVI, etc. Special formats downloaded with a dedicated player need to be converted; In addition, considering the amount of data, the length of the video should not exceed one minute. After transcoding mp4, the video of this operation has a watermark (trial version), it is not sure whether it will affect the subsequent recognition.

2. Split the video into pictures in.jpg format. According to the OpenCV code provided in this class, after the local test was successful, it was put into ModelArts for debugging, but failed.

2.1 The code of local operation is shown as follows:

2.2 The frame rate is 25, and 1 is taken from 10 frames to separate 116 pictures with a size of 1920*1080. The following figure shows the execution process

2.3 Upload images to the path of data set of Yolov3 project in OBS bucket through OBS-Browser-Plus;

2.4 Modify the predit.py code to adapt to the reasoning of batch images, and upload the Yolov3 code to the OBS bucket.

Ps: 2.4.1 The picture directory should be read and processed in the order of name;

2.4.2 Detection = DetectionEngine(ARGS) statement should be placed in the loop; otherwise, the Bounding box of the last image will be overlapped and the prediction result will be wrong. Extremes are shown below:

2.5 Upload the Yolov3 code to the Yolov3 code directory in the OBS bucket and enable predicter. py. After the printed information of the image traversal is output, the image detection work is completed and output to the set OBS output directory. See the following figure for ModelArts detection log:

Ps: Pay attention to the addition of checkpoint_PATH configuration, as a training model for inference. For details, see Advanced Job steps.

2.6 Download the image using OBS-Browser-Plus and merge it into a video using the code. Again, ModelArts tried to run without success. The local run code is as follows:

The printed information of the synthesis operation is as follows:

At this point, the process of the advanced job is basically complete.

Postscript:

1. The 3000 basketball game pictures used in the training of this course are completed by using picture markers on ModelArts, which can be used as a starting point for in-depth understanding of AI model expansion;

2. The code of GPU version is provided in this course. Those that are not realized in ModelArts can try to automatically complete image segmentation, detection and merger under the GPU environment.

3. After this class, the teacher added the code of Yolov4, so that you can try to experience whether the detection accuracy is improved compared with Yolov3. This item is currently being processed and reported as an error. It has not been written yet, and will be filled later. Thank you!

This article is shared by Dasming from Huawei Cloud community “Basketball Action Detection Experience Based on MindSpore Framework Yolov3-Darknet Model”.

Click to follow, the first time to learn about Huawei cloud fresh technology ~