Skip to content

BraverCole/orefsdet

Repository files navigation

OreFSDet

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

OreFsdet and baseline on ore dataset

Method 5-shot 15-shot 25-shot
AP AP75 AP AP75 AP AP75
Attentionrpn(baseline) 25.1 27.0 29.2 34.5 30.8 37.0
orefsdet 36.2 33.0 39.3 45.6 44.7 48.4

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 here. 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=0 python3 fsod_train_net.py --num-gpus 1 \
	--config-file configs/fsod/finetune_R_50_C4_1x.yaml 2>&1 | tee log/fsod_finetune_stone_R50_train_log_5shot.txt

Then, run the following

sh all.sh

Evaluation

change the all.sh

CUDA_VISIBLE_DEVICES=0 python3 fsod_train_net.py --num-gpus 1 \
	--config-file configs/fsod/finetune_R_50_C4_1x.yaml \
	--eval-only MODEL.WEIGHTS ./output/fsod/finetune_dir/R_50_C4_1x_stone_5shot/model_final.pth 2>&1 | tee log/fsod_finetune_stone_R50_test_log_5shot.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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published