Perform custom object detection using YOLO algorithm and deploy it via web app in Python
- Create your python virtual environment
pip3 install virtualenv
python3.9 -m venv yolo_env
(Note: to work with labelImg, the stable version of Python is 3.9)
- Install all packages in the
requirements.txt
file
pip3 install -r requirements.txt
- [Optional] Install prerequisites of labelImg package in our system to help us labeling the image
brew install libxml2
brew install qt5
brew link qt5 --force
- [Optional] Install labelImg package in your newly-created python environment
source <python_virenv>/bin/activate
pip3 install --upgrade pip
pip3 install pyqt5 --config-settings --confirm-license= --verbose
pip3 install labelImg
- [Optional] Check the list of installed packages
pip list
- Run the
main_object_detection_[image/realtime].py
usingyolo_env
Python environment.
- For a simple classification task, the images generally have a single dominant object and the whole image is classified accordingly.
- It is the next step of classification technique. To find the position of object in the image, we require the object to be localized.
- This localization is performed using regression provides bounding box (x_min, y_min, x_max, y_max).
- Object detection in simple words finds objects in image and categorizes or classifies them.
- Detection is the case of identifying or detecting objects in images.
- It includes both the task mentioned before and can be better understood in case of images with multiple objects to be detected.
There are two major evaluation techniques that will perform for object detection model:
- Intersection Over Union (IoU)
- mean Average Precision (mAP)
- In general, IoU > 50% is consider as good prediction. (~ mAP 0.5)
- In order to understand mAP, let's familiarize again with a confusion matrix as the representation for object detection model.
-
True Positive:
- IoU > 50% (~ mAP 0.5)
- Both belong to the correct class
-
False Negative:
- IoU > 50% (~ mAP 0.5)
- Incorrect class prediction
-
False Positive:
- IoU < 50%
- Correct class prediction
-
True Negative:
- No detection when there is no object.
To evaluate object detection models like R-CNN and YOLO, the mean average precision (mAP) is used. The mAP compares the ground-truth bounding box to the detected box and returns a score. The higher the score, the more accurate the model is in its detections. (Source: https://blog.paperspace.com/mean-average-precision/)
FAQ: