This repository contains IC4U's object detection related projects code template. This code template can be used for building a custom object detector using the ZED 2i stereo camera, the ZED SDK, and a custom Pytorch weight.
To see more of IC4U, visit my YouTube channel.
- Get the latest ZED SDK and pyZED Package
- Check the Documentation
- Clone this repository into your ZED folder
git clone https://github.com/saornek/IC4Us-Zed-Camera-Template.git
- Then clone Yolov5 into the current folder
git clone https://github.com/ultralytics/yolov5
# Install the dependencies if needed
cd yolov5
pip install -r requirements.txt
- Download a model file (or prepare your own) https://github.com/ultralytics/yolov5/releases
# Downloading by commmand line
wget https://github.com/ultralytics/yolov5/releases/download/v6.0/yolov5m.pt
- Prepare your Labels CSV file.
I chose to use a CSV file so, I could match the label ID of each detected object with its corresponding label name. In this code, I researched what dataset yolov5 model uses. I saw that it used the MSCOCO dataset, so I created a CSV file with the object's IC4U required for its intelligent disobedience feature.
You can adjust or create a CSV file according to your projects requirements.
A CSV file example format:
label_id, label
0, person
1, bicycle
2, car
NOTE: The ZED 1 is not compatible with this module
python detector.py --weights yolov5m.pt # [--img_size 512 --conf_thres 0.1 --svo path/to/file.svo]
This sample can use any model trained with YOLOv5, including custom trained one. For a getting started on how to trained a model on a custom dataset with YOLOv5, see here https://docs.ultralytics.com/tutorials/train-custom-datasets/
I have prepared my datasets for IC4U's weights using Roboflow. I highly recommend Roboflow for its simplicity and speed in managing and annotating datasets.
Contributions to this repository are welcome. If you find any bugs or have suggestions for improvements, please feel-free to submit a pull request.
Thank you to Stereolabs for providing the ZED SDK, the custom object detector tutorial and their endless support.
For any questions or support related to this library, you can contact me via the repository issues page.