This project aims to detect strategic fruits cards using YOLOv8. It is implemented in Python and uses several libraries for data processing and model training.
The project has the following structure:
src/main/python/model_training/cards-object-detection-dataset/: Contains the dataset used for training the model.environment.yml: Contains the conda environment configuration.
Ensure you have the following installed on your system:
- Python 3.12.3
- Conda package manager
- Cuda Toolkit 12.3
- Suggested IDE:
- VSCode with Python and Jupyter extensions
- PyCharm Professional is also a good choice if you have a license
- Clone the repository:
git clone https://github.com/MacMat01/cards-object-detection.git- Navigate to the project directory:
cd strategic-fruits-card-detection- Create a new conda environment from the
environment.ymlfile:
conda env create --name cards-object-detection -f environment.yml- Activate the conda environment:
conda activate cards-object-detection- Install the
buildandpiptools:
pip install --upgrade build pip- Build a source distribution (sdist) and a binary distribution (wheel) of your package:
python -m build- Install the package from the wheel file:
pip install --user dist/*.whl # If it doesn't work, change </*.whl> to the name of the wheel file generated in step 6- (OPTIONAL) If gpu isn't working for model training, install pytorch-cuda manually (remember to restart pc, it often works):
conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidiaTo run the main application, navigate to the src/main/python/app directory and run the app.py script:
cd src/main/python/appFor the Real Time application, run the following command:
python real_time_app.pyFor the On Demand application, run the following command:
python on_demand_app.pyIf you want to use the data extraction application with the cards object detection, please switch to the data-extraction/main branch:
git checkout data-extraction/mainThen, follow the instructions in the README.md file in the data-extraction/main branch.
Follow the instruction in the following Jupyter notebooks:
Cards Extraction.ipynbDataset Creation.ipynbCards Object Detection - YOLOv8.ipynb
Ensure you have Jupyter installed in your environment, and start it with:
jupyter notebookNavigate to the notebooks directory and open the respective notebook.
This project is licensed under the MIT License—see the LICENSE file for details.