Versionen im Vergleich
Schlüssel
- Diese Zeile wurde hinzugefügt.
- Diese Zeile wurde entfernt.
- Formatierung wurde geändert.
The crucial goal of object detection on images is, to classify and find (multiple) occurrences of different object categories. There exists a wide variety of neural network architectures tackling this task.
These networks are as a general rule compared based on well-known datasets such as COCO with regards to their mAP (mean average precision) score.
Some popular choices at the time of writing this are e.g.
- Faster R-CNN
- SSD-MobileNet
- YOLOv4
Especially the YOLO architectures has have proven to be a quite uniquely great balance between detection/classification accuracy and performance, even on lower-end devices such as mobiles.
In this article, we will have a look at how YOLO in combination mit PyTorch can be used on Palma to train a new YOLO-model which can be used for object detection on your own images. After the training procedure you can download your model and, for example, start the inference on your own device. Further, we will use the modified YOLOv4-CSP architecture, which is currently the best performing YOLO.
Preparation
Before we can start training, we will first have to install some requirements for the PyTorch implementation of YOLOv4-CSP. Using Python, most of them can be installed by using Python's package manager pip
. As we want to use a GPU to accelerate the training process, we use Palma's gputitanrtx
queue. For installation of the requirements it is recommended to queue an interactive job on one of the gputitanrtx
hosts, so that any compiling involved is done on the correct hardware architecture.
First thing to do on the GPU node is to load the required modules to our shell session, e.g.
Codeblock | ||
---|---|---|
| ||
module load palma/2019b
module load fosscuda
module load OpenCV
module load PyTorch
module load torchvision |
Now we can start to install our requirements. You can download this requirements.txt which should include all necessary packages and then upload it to your home directory on Palma an install it via
Codeblock | ||
---|---|---|
| ||
pip3 install --user -r requirements.txt |
One last required package has to be installed manually: mish-cuda, which provides a CUDA accelerated implementation of the MISH activation function. To install it you can use
Codeblock | ||
---|---|---|
| ||
git clone https://github.com/JunnYu/mish-cuda
pip3 install --user ./mish-cuda |
Finally, as a last step, we can clone the PyTorch implementation of YOLO itself with
Codeblock | ||
---|---|---|
| ||
git clone git clone --single-branch --branch yolov4-csp https://github.com/WongKinYiu/ScaledYOLOv4 |
You should now have a folder called ScaledYOLOv4
in which you can find the necessary Python scripts for training and inference. You can now exit you shell session on the GPU host.