This task is based on yolov5 to produce butterfly detection
See the YOLOv5 for the reference
Install
a. Install conda and create virtual environment for this task
conda create -n countbutterfly python=3.7
conda activate countbutterfly
conda install pip
b. Clone yolov5 repo and install requirements.txt in a Python>=3.7.0 environment, including PyTorch>=1.7.
git clone https://github.com/ultralytics/yolov5 # clone
cd yolov5
pip install -r requirements.txt # install
c. Clone this repo and put all the files into yolov5 folder.
git clone https://github.com/hhlim333/CountButterfly.git
d. Put butterfly.yaml into "data/" folder and (train,valid) folder into "data/image/" folder
a. You can use your computer
cd yolov5
python train.py --img 250 --batch 14 --epochs 150 --data data/butterfly.yaml --weights yolov5s.pt --nosave --cache
b. google-colab
https://colab.research.google.com/drive/1LSNiUjIzOLYqoQ929K0qCcglM9ulgdK4?usp=sharing
After training, you can get the last.pt file for the trained model
Using counterbutterfly.py to show the result.
python countbutterfly.py