DetectiveKite is a free perch mount camera trap images auto-detection system which is developed base on yolov5s, a light and fast object detection architecture. I believe DetectiveKite can help biologists in Taiwan to accelerate the heavy species labeling works.
- Private data from Endemic Species Research Institute
- Landscape Pictures, Kaggle
- Owner: Arnaud ROUGETET
- Landscape color and grayscale images, Kaggle
- Owner: Black Mamba
- Private data from Institute of Wildlife Conservation, National Pingtung University of Science and Technology
- Private data from Department of Biological Resources, National Chiayi University
- iNaturalist
yolov5 need python>=3.7.0, DetectiveKite is developed under 3.9.10
Please refer to the "FFmpeg 安裝" and "安裝 CUDA、cuDNN" of SILIC 環境設定 for Window 10 or 11
git clone https://github.com/Chendada-8474/DetectiveKite.git
cd DetectiveKite
pip install -r requirements.txt
For GPU acceleration, please install the compatible torch package with your device. see INSTALL PYTORCH. Futhermore, installing CUDA Toolkit correctly is also necessary.
Colab is an easy way to execute python on browser.
- setting friendly
- free GPU
- easy to share code
detect.py
runs source of a folder. use --source
or -so
to set path of target folder. The results will be saved to runs/data/
.
python detect.py -so path\ # directory
Trail camera normally fill infrared light at night or in bad light condition when animals are detected and take a black and white photo. Otherwise, it takes color photo in Natural light. Two models are used to detect color and infrared image saperatly. So, please note that some parameter have to be set saperatly.
argument | abbreviation | parameter | default | require |
---|---|---|---|---|
--source |
-so |
path | True | |
--batch-size |
-bs |
batch size, positive integer | True | |
--classes-color |
-cc |
int series | all classes | False |
--classes-infrared |
-ci |
int series | all classes | False |
--conf-thres-color |
-ctc |
float, range 0~1 | 0.25 | False |
--conf-thres-infrared |
-cti |
float, range 0~1 | 0.25 | False |
--vedio-interval |
-vi |
float (second) | 1 | False |
--name |
-na |
results folder name | exp | False |
--sp-name |
-sn |
sci, ch or jp | en | False |
Please set this as big as you can.
python detect.py -so path\ -bs 24 # Batch Size 24
When deteting, you are able to use
--classes-color
and --classes-infrared
to spefify classes. Information of classes is in ./model/exp_color/classes_color.csv
and ./model/exp_infrared/classes_infrared.csv
.
python detect.py -so path\ # all classes
color
python detect.py -so path\ -cc 0 # only specify class o
0 15 # specify class 0 and 15
infrared
python detect.py -so path\ -ci 0 # only specify class o
0 3 # specify class 0 and 3
or both
python detect.py -so path\ -cc 0 15 -ci 0 3
Setting the confidence threshold when detecting using --conf-thres-color
and conf-thres-infrared
. The results which confidence is below than confidence threshold will not be saved.
python detect.py -so path\ -ctc 0.6 -cti 0.75
Detecting EACH frame of video just for knowing what kind of birds stanted on perch mount is not a efficient way. DetectiveKite detect video in interval to speed up the processing of detection. Set --video-interval
to adjust the suitable detection interval base on your video length.
python detect.py -so path\ -vi 2 # detect video frame only in 2s interval
After detection, results will be saved to ./runs/data/exp/
. exp is the default folder name. You can change the name via --name
.
python detect.py -so path\ -na project
Then, results will be saved to ./runs/data/project/
The species name is saved in English common name (default). You can choose in scientific name, Chinese common name, Japanese common or Multiple.
name | lang code |
---|---|
scientific name | sn |
Chinese common name | ch |
Japanese common name | jp |
non for English common name
python detect.py -so path\
add name
python detect.py -so path\ -sn ch # add Chinese common name
sci # add scientific name
jp # add Japanese name
ch sci jp # Multiple is also legal
If you want some thing cool like these:
Please use yolov5 detect
to do it. see yolov5 package
or video
example:
yolov5 detect --source ./sample/img019.jpg --weights ./model/exp_color/best.pt # color media
yolov5 detect --source ./sample/img001.jpg --weights ./model/exp_infrared/best.pt # infrared media
Results are saved as .csv format. Columns: file_name, class, name, num_inds, confidence, media, model.
Information of columns:
column | data type | description |
---|---|---|
file_name | string | file name of image or video |
class | integer | code of class |
name | string | name of detected species |
num_inds | integer | number of individuals detected |
confidence | float | see this |
datetime | datetime | file create datetime |
media | string | image or video |
model | string | detected by color model or infrared model |
xmin | integer | minimum pixel of bounding box on x axis |
ymin | integer | minimum pixel of bounding box on y axis |
xmax | integer | maximum pixel of bounding box on x axis |
ymax | integer | maximum pixel of bounding box on y axis |
NOTE: If detected media is video, the confidence is the average of every detected frame. In image, if two or more individuals detected, the xmin and ymin are the smallest values of xmin and ymin. The xmax and ymax are the biggest values of xmax and ymax. In video, the xmin and ymin are the smallest values of xmin and ymin of all frames. The xmax and ymax are the biggest values of xmax and ymax of all frames.
review.py
is a GUI interface results reviewer.
python review.py
Key | Description type |
---|---|
A | previous media |
D | next media |
L | add species |
C | confirm changes |
1 ~ 9 | focus to the species input box of row 1 ~ 9 |
Ctrl + 1 ~ 9 | delete the species input box of row 1 ~ 9 |
Ctrl+S | save csv file |
NOTE: If some video formats are not supported, try installing K-lite.
Althought, this is not a big project, I maintain this project without any financial or funds support. If you think this is great and want to encourage me, donation would be so helpful!
In addition, if you have tons of perch mount images and videos are waited to be labeled, we could cooperate! contact me!
https://p.ecpay.com.tw/0696F33
https://paypal.me/tachihchen