Skip to content

Commit e2ca474

Browse files
committed
added yolo object detection tutorial
1 parent 3647fcc commit e2ca474

25 files changed

+1967
-1
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ This is a repository of all the tutorials of [The Python Code](https://www.thepy
3636
- [How to Detect Contours in Images using OpenCV in Python](https://www.thepythoncode.com/article/contour-detection-opencv-python). ([code](machine-learning/contour-detection))
3737
- [How to Recognize Optical Characters in Images in Python](https://www.thepythoncode.com/article/optical-character-recognition-pytesseract-python). ([code](machine-learning/optical-character-recognition))
3838
- [How to Use K-Means Clustering for Image Segmentation using OpenCV in Python](https://www.thepythoncode.com/article/kmeans-for-image-segmentation-opencv-python). ([code](machine-learning/kmeans-image-segmentation))
39+
- [How to Perform YOLO Object Detection using OpenCV and PyTorch in Python](https://www.thepythoncode.com/article/yolo-object-detection-with-opencv-and-pytorch-in-python). ([code](machine-learning/object-detection))
3940
- [Building a Speech Emotion Recognizer using Scikit-learn](https://www.thepythoncode.com/article/building-a-speech-emotion-recognizer-using-sklearn). ([code](machine-learning/speech-emotion-recognition))
4041
- [How to Convert Speech to Text in Python](https://www.thepythoncode.com/article/using-speech-recognition-to-convert-speech-to-text-python). ([code](machine-learning/speech-recognition))
4142
- [Top 8 Python Libraries For Data Scientists and Machine Learning Engineers](https://www.thepythoncode.com/article/top-python-libraries-for-data-scientists).
@@ -44,7 +45,6 @@ This is a repository of all the tutorials of [The Python Code](https://www.thepy
4445

4546
- ### [General Python Topics](https://www.thepythoncode.com/topic/general-python-topics)
4647
- [How to Make Facebook Messenger bot in Python](https://www.thepythoncode.com/article/make-bot-fbchat-python). ([code](general/messenger-bot))
47-
4848
- [How to Get Hardware and System Information in Python](https://www.thepythoncode.com/article/get-hardware-system-information-python). ([code](general/sys-info))
4949
- [How to Control your Mouse in Python](https://www.thepythoncode.com/article/control-mouse-python). ([code](general/mouse-controller))
5050
- [How to Control your Keyboard in Python](https://www.thepythoncode.com/article/control-keyboard-python). ([code](general/keyboard-controller))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# [How to Perform YOLO Object Detection using OpenCV and PyTorch in Python](https://www.thepythoncode.com/article/yolo-object-detection-with-opencv-and-pytorch-in-python)
2+
To run this:
3+
- `pip3 install -r requirements.txt`
4+
- Download the model weights and put them in `weights` folder.
5+
- To generate a object detection image on `images/dog.jpg`:
6+
```
7+
python yolo_opencv.py images/dog.jpg
8+
```
9+
A new image `dog_yolo3.jpg` will appear which has the bounding boxes of different objects in the image.
10+
- For live object detection:
11+
```
12+
python live_yolo_opencv.py
13+
```
14+
- If you want to read from a video file and make predictions:
15+
```
16+
python read_video.py video.avi
17+
```
18+
This will start detecting objects in that video, in the end, it'll save the resulting video to `output.avi`
19+
- If you wish to use PyTorch for GPU acceleration, please install PyTorch CUDA [here](https://pytorch.org/get-started) and use `yolo.py` file.
20+
- Feel free to edit the codes for your needs!

0 commit comments

Comments
 (0)