For everyone who uses VSCode, this should work almost out of the box. Just open the project folder in VSCode, make sure you have Docker installed, and you should be able to "Open in Container" from the Remote Development extension. (You may need to install the extension first.)
If you don't use VSCode, you can still use Docker to run the project. Just run the following command in the project directory:
docker build -t yolollm .devcontainer/Dockerfile
docker run -it --rm -v $(pwd):/app yolollm
This will build the Docker image and run a container with the project mounted at /app
. You can then run the project as usual. (Connect to the container, activate the virtual environment, and run the script.)
Note: Remember to install the required dependencies in the virtual environment by running poetry install --no-root
before running the script.
If you need to add a new dependency, you can do so by running the following command:
poetry add <package>
This will add the package to the pyproject.toml
file and install it in the virtual environment.
This project captures video input from the camera and processes frames using YOLO (You Only Look Once) with OpenCV.
- Python 3.x
- OpenCV
- Numpy
- YOLO configuration, weights, and class names files
-
Create and activate a virtual environment:
python3 -m venv venv source venv/bin/activate
-
Upgrade pip and setuptools:
pip install --upgrade pip setuptools
-
Install the required packages:
pip install -r requirements.txt
-
Download YOLO files:
Download the following files and place them in the models directory:
yolov8n.pt
-
Run the script:
Ensure your virtual environment is activated, and then run the script:
python main.py
- Ensure you have the necessary permissions to access the camera.
- The script is designed to process as many frames as possible in real-time, but performance may vary depending on your hardware.