Skip to content

MVME-HBUT/Faster-OreFSDet

Repository files navigation

Faster-OreFSDet

Image text Offical codes for "Faster OreFSDet: A Lightweight and Effective Few-shot Object Detector for Ore Images", which has been accepted by PR (2023).

Faster-OreFSDet is based on FewX ( an open source toolbox on top of Detectron2 for data-limited instance-level recognition tasks, e.g.) The basic detector is CenterNet2.

Faster-OreFsdet and baseline on ore dataset

Method 5-shot 15-shot 25-shot Size FPS
AP AP75 AP AP75 AP AP75
Attentionrpn(baseline) 25.1 27.0 29.2 34.5 30.8 37.0 211 28
Faster-OreFSDet 48.5 57.6 52.1 62.5 54.1 64.7 19 50

The model can be obtained from here model .

Step 1: Installation

You only need to install detectron2. We recommend the Pre-Built Detectron2 (Linux only) version with pytorch 1.7. I use the Pre-Built Detectron2 with CUDA 10.1 and pytorch 1.7 and you can run this code to install it.

python -m pip install detectron2 -f \
  https://dl.fbaipublicfiles.com/detectron2/wheels/cu101/torch1.7/index.html

Step 2: Prepare dataset

  • Prepare for ore dataset, you can get from Orev1. The ore dataset has been handled under few-shot setting, you only need to add it to dataset.

Step 3: Training and Evaluation

Run sh all.sh in the root dir.

Training

change all.sh

rm support_dir/support_feature.pkl
CUDA_VISIBLE_DEVICES=XX python3 fsod_train_net.py --num-gpus XX \
	--config-file configs/fsod/finetune_vovnet.yaml 2>&1 | tee log/fsod_finetune_vovnet_cen_train_25shot.txt

Then, run the following

sh all.sh

Evaluation

change the all.sh

CUDA_VISIBLE_DEVICES=XX python3 fsod_train_net.py --num-gpus XX \
	--config-file configs/fsod/finetune_vovnet.yaml.yaml \
	--eval-only MODEL.WEIGHTS ./output/fsod/finetune_dir/vovnet_25shot/model_final.pth 2>&1 | tee log/fsod_finetune_stone_vovnet_25_test_log.txt

just run the following

sh all.sh

Visualize the results

python demo.py  \
    --config-file configs/fsod/finetune_R_50_C4_1x.yaml \
    --input directory/*.png \
    --output results \
    --opts MODEL.WEIGHTS ./output/fsod/finetune_dir/R_50_C4_1x/model_final.pth

This repo is developed based on FewX and detectron2. Thanks for their wonderful codebases.

Cite

@ARTICLE{Faster_OreFSDet,  
author={Yang Zhang, Le Cheng, Yuting Peng, Chengming Xu, Yanwei Fu, Bo Wu, Guodong Sun},  
journal={Pattern Recognition},   
title={{Faster OreFSDet: A Lightweight and Effective Few-shot Object Detector for Ore Images}},   
year={2023},  
volume={141},  
number={9},  
pages={109664},  
doi={10.1016/j.patcog.2023.109664}

About

Offical codes for "Faster OreFSDet: A Lightweight and Effective Few-shot Object Detector for Ore Images", which has been accepted by Pattern Recognition.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published