| layout | post | |
|---|---|---|
| title | Object Detection | |
| author |
|
The quantity of indicator species in coral reefs is a critical reference for coral surveys. However, manual calculation requires a significant amount of human resources and time. Therefore, utilizing artificial intelligence for automated classification and counting is of utmost importance. The objective of this study is to achieve an accuracy of over 85% in correctly identifying common designated indicator fish species (Parrotfish, Snappers, Butterflyfish, Groupers, and Wrasses) in the Northeastern coastline. Additionally, the accuracy for other fish species should be above 80%. This approach not only reduces the training time for identification personnel but also enables continuous monitoring, potentially allowing for real-time surveillance 24 hours a day.
This research employs the YOLOv5 algorithm for fish species recognition. The development environment is set up on Anaconda, using Python 3.9.0 as the programming language, and deep learning is performed using PyTorch 1.2 + CUDA 10.0 as the framework. Training is conducted on the Taiwan AI Cloud Computing (TWCC) server. Transfer Learning is employed during the training process, utilizing the YOLOv5 provided pre-trained weights 'yolov5m.pt' . This approach accelerates the training efficiency and safeguards against weight corruption.
- python = 3.9.0
- CUDA = 10.0
- Pytorch =1.2
conda create -n 'your_environment_name' python=3.9.0
conda activate 'your_environment_name'
$pip install labelImg
- YOLO format in .txt
class_num x, y, w, h
0 0.5222826086956521 0.5518115942028986 0.025 0.010869565217391304
0 0.5271739130434783 0.5057971014492754 0.013043478260869565 0.004347826086956522
Install
conda install git
git clone https://github.com/Alanlee0323/Coral_Reef_Restoration_Indicator_Fish_Species---Based_on_YOLOv5 # clone
cd Coral_Reef_Restoration_Indicator_Fish_Species---Based_on_YOLOv5
pip install -r requirements.txt # installInference with detect.py
detect.py runs inference on a variety of sources, and saving results to runs/detect.
python detect.py --weights weights/Original_Imgsize_1280_batchsize_16_epoch_200_models_yolov5m.pt --source https://www.youtube.com/watch?v=8_EygRvwzrY # demo Youtube video
img.jpg # image
vid.mp4 # video
screen # screenshot
path/ # directory
list.txt # list of images
list.streams # list of streams
'path/*.jpg' # glob
'https://youtu.be/Zgi9g1ksQHc' # YouTube
'rtsp://example.com/media.mp4' # RTSP, RTMP, HTTP stream
Training
python train.py --data FIsh/Coral_Reef_Restoration_Indicator_Fish_Species --epochs 200 --cfg ./models/yolov5s.yaml --weights weights/yolov5m.pt --batch-size 16NSTC-110-2634-F-019 -002 -

