bingykang / Fewshot_Detection

Few-shot Object Detection via Feature Reweighting
https://arxiv.org/abs/1812.01866
526 stars 111 forks source link

Has any one run detect.py ? #39

Closed infrontofme closed 4 years ago

infrontofme commented 4 years ago

Hi, I've trained the model following the instructions, after finetuning on novel classes, the AP results are as follows:

AP for aeroplane = 0.6602
AP for bicycle = 0.4766
AP for bird = 0.3573
AP for boat = 0.4778
AP for bottle = 0.3153
AP for bus = 0.2155
AP for car = 0.6892
AP for cat = 0.8144
AP for chair = 0.3652
AP for cow = 0.3928
AP for diningtable = 0.5538
AP for dog = 0.6887
AP for horse = 0.6958
AP for motorbike = 0.4364
AP for person = 0.6416
AP for pottedplant = 0.2839
AP for sheep = 0.5383
AP for sofa = 0.3712
AP for train = 0.7394
AP for tvmonitor = 0.6614
~~~~~~~~
Mean AP = 0.5187
Mean Base AP = 0.5734
Mean Novel AP = 0.3546

Then, I want to make predictions using pre-trained weights, but I found it in darknet_dynamic.cfg, classes=1. I modify classes=20 during inference in order to make predictions on VOC. but the result is worse. predictions

how can I use pre-trained weight to make the right predictions?

thanks:)

christegho commented 4 years ago

Which script did you use to get the predictions for the image you posted?

The following command should work (you need to change the weights path and the image path):

python2 detect.py cfg/darknet_dynamic.cfg cfg/reweighting_net.cfg  backup/metatunetest15_novel0_neg0/000010.weights image_test.jpg
infrontofme commented 4 years ago

@christegho

python2 detect.py cfg/darknet_dynamic.cfg cfg/reweighting_net.cfg backup/metatunetest15_novel0_neg0/000010.weights image_test.jpg

This script doesn't work, the model in detect.py can't take cfg/reweightng_net as an input parameter.

I use the following script, but the result is worse.

python2 detect.py cfg/darknet_dynamic.cfg backup/metatunetest15_novel0_neg0/000010.weights image_test.jpg

before tested on images, do I need to generate reweighting vectors using training images ?

kshitijagrwl commented 4 years ago

detect.py will not work as you rightly mentioned @infrontofme

You will have to follow some methodology similar to valid_ensemble.py:

  1. Generate dynamic_weights from model.meta_forward()
  2. Generate output from model.detect_forward()
  3. Generate bbox from get_region_boxes()
infrontofme commented 4 years ago

@kshitijagrwl Thanks, I get it now.