Master's thesis 15.01.2017 - 01.06.2017
Publication link: http://hdl.handle.net/10037/11218
Unified Detection System for Automatic, Real-Time, Accurate Animal Detection in Camera Trap Images from the Arctic Tundra
$ROOT refers to the unified-detection-system root directory.
$baitcam refers to baitcam dataset directory.
- Refer to $ROOT/INSTALL.md
- Any dataset used with the Unified Detection System should follow the initial structure of Baitcam from the thesis:
$baitcam/images # Contains images
$baitcam/pascal_Annotations # Contains .xml annotations (pascal format)
$baitcam/pascal_Imagesets # Contains train.txt and val.txt imagesets (pascal format)
$baitcam/baitcam_labelmap.prototxt # Contains labels and class names
- Convert to SSD data format:
cd $ROOT/data/data_utils
python convert_pascal_2_ssd.py -h # To see arguments
python convert_pascal_2_ssd.py 'dataset_dir' 'labelmap'
# example: python convert_pascal_2_ssd.py ~/datasets/baitcam ~/datasets/baitcam/baitcam_labelmap.prototxt --resize-width 300 --resize-height 300
- This should create:
$baitcam/ssd_ImageSets # Contains train.txt, val.txt, val_name_size.txt imagesets (SSD format)
$baitcam/train_lmdb # Contains .mdb files
$baitcam/val_lmdb # Contains .mdb files
- Convert to YOLOv2 data format:
cd $ROOT/data/data_utils
python convert_pascal_2_yolov2.py -h # To see arguments
python convert_pascal_2_yolov2.py 'dataset_dir' 'labelmap'
# example: python convert_pascal_2_ssd.py ~/datasets/baitcam ~/datasets/baitcam/baitcam_labelmap.prototxt
- This should create:
$baitcam/yolov2_ImageSets # Contains train.txt and val.txt imagesets (YOLO format)
$baitcam/yolov2_Annotations # Contains .txt annotations (YOLO format)
- Create custom anchor boxes for dataset (optional):
cd $ROOT/data/data_utils
python k_means_anchor_boxes.py -h # To see arguments
python k_means_anchor_boxes.py 'dataset_dir'
# example: python convert_pascal_2_ssd.py ~/datasets/baitcam --k 5 --info
- This should create:
$baitcam/custom_anchor_boxes/5_anchor_boxes.txt
- Download pretrained weights, link in $ROOT/imagenet_models/download.txt
- Run unified detection system:
cd $ROOT
python run.py -h # To see arguments
python run.py --dataset 'dataset_name' --method 'method_name' --model 'model_name'
# example: python run.py --dataset baitcam --method ssd --model VGG16_reduced
- This should create output directory:
$ROOT/output/baitcam/ssd/VGG16_reduced # Contains model weights, logfile, config etc.
- Run unified detection system:
cd $ROOT
python run.py -h # To see arguments
python run.py --eval --output_dir 'output_dir'
# example: python run.py --eval --output_dir /output/baitcam/ssd/VGG16_reduced
- This should create results directory:
$ROOT/output/baitcam/ssd/VGG16_reduced/results # Contains result files and Precision-recall curve
- Run unified detection system:
cd $ROOT
python run.py -h # To see arguments
python run.py --detect --output_dir 'output_dir' --image_dir 'image_dir'
# example: python run.py --detect --output_dir /output/baitcam/ssd/VGG16_reduced --image_dir ~/baitcam_test_images
- This should create detections file:
~/baitcam_test_images_detections.txt
- Run visualization script:
cd $ROOT
python visualize_detections.py -h # To see arguments
python visualize_detections.py 'detection_file'
# example: python visualize_detections.py ~/baitcam_test_images_detections.txt --labelmap ~/datasets/baitcam/baitcam_labelmap.prototxt --vis_thresh 0.5