Domain-specific-Fewshot-Learning
Domain-specific-Fewshot-Learning copied to clipboard
Pytorch implementation of the Trans paper "Few-shot Learning for Domain-specific Fine-grained Image Classification"
Domain-specific-Fewshot-Learning
Pytorch implementation of the Trans paper "Few-Shot Learning for Domain-Specific Fine-Grained Image Classification"
Centerloss and CNloss on FashionMNIST
Space distribution


For example, the 2-th category Pullover (green color) and 6-th category Shirt (pink color). Centerloss is difficult to form their own cluster fastly and robustly.
Test on FashionMNIST
Performance in general classification tasks.
python3 test_loss.py
Accuracy | Softmax loss | Center loss | CN loss |
---|---|---|---|
(%) | 89.5± 0.2 | 90.0±0.2 | 91.42±0.3 |
The three use a unified network and parameter settings.
CUB-200-2011
Usage
Prepare dataset
-
Download CUB_200_2011 Dataset. Unzip and locate it in this directory.
/home/***/datasets/CUB_200_2011/
-
If you want the focus-areas generated by us. Download CUB_Attention_Area.
/home/***/datasets/CUB_Attention/
-
If you want the focus-areas generated by yourself. ( Grad-cam and crop-resize operation are about 9 images per second. )
-
Please re-training model.
-
Run
python3 generate_cub_focus.py
-
Testing
Default testing, only on novel classes and without focus-areas.
cd CUB
python3 test_cub.py
You can change the switch of "withAtt", "novelonly","SUPPORT_NUM" of test_cub.py.
Re-training
python3 train_cub.py
miniPPlankton
Dataset
-
Download miniPPlankton. Unzip and locate it in this directory.
/home/***/datasets/phytoplankton/fewshot/
| SmallTrain
| SmallTest
-
Download miniPPlanktonFocusAreas.Unzip and locate it in this directory. (You can also generate them during the training and testing process.)
/home/***/datasets/phytoplankton/fewshot/
| SmallTrainAtt
| SmallTestAtt
Testing
python3 test_plank.py
The experimental results here use a pre-trained ( ImageNet ) model.
Acc(%) | 5way-1shot | 5way-5shot | 10way-1shot | 10way-5shot |
---|---|---|---|---|
Imprint | 81.55 | 93.27 | 71.93 | 89.65 |
+CNloss | 83.24 | 93.79 | 73.76 | 90.31 |
+Att | 83.35 | 94.10 | 73.9 | 90.45 |
The model may have reached the data bottleneck, using "Att" only brings a slight boost.
Others
- Please refer to the citations in this paper for miniDogs datasets.
- The center point dimension of loss functions can be set by itself.