gidariss / FewShotWithoutForgetting

MIT License
519 stars 110 forks source link

Hard-coded parameters in evaluate.py leads to errors #6

Closed xwjabc closed 6 years ago

xwjabc commented 6 years ago

In evaluate.py:

dloader_test = FewShotDataloader(
     dataset=MiniImageNet(phase=test_split),
     nKnovel=5, # number of novel categories on each training episode.
     nKbase=64, # number of base categories.
     nExemplars=nExemplars, # num training examples per novel category
     nTestNovel=15 * 5, # num test examples for all the novel categories
     nTestBase=15 * 5, # num test examples for all the base categories
     batch_size=1,
     num_workers=0,
     epoch_size=epoch_size, # num of batches per epoch
)

When evaluating the Proto Nets/Matching Nets, the hard-coded parameters above leads to some error related to missing Kbase_ids in FewShot.py because nKbase is set as non-zero (64). A possible fix is:

data_test_opt  = config['data_test_opt']
dloader_test = FewShotDataloader(
    dataset=MiniImageNet(phase=test_split),
    nKnovel=data_test_opt['nKnovel'], # number of novel categories on each training episode.
    nKbase=data_test_opt['nKbase'], # number of base categories.
    nExemplars=data_test_opt['nExemplars'], # num training examples per novel category
    nTestNovel=data_test_opt['nTestNovel'], # num test examples for all the novel categories
    nTestBase=data_test_opt['nTestBase'], # num test examples for all the base categories
    batch_size=data_test_opt['batch_size'],
    num_workers=args_opt.num_workers, #0
    epoch_size=epoch_size # num of batches per epoch # data_test_opt['epoch_size']
)
gidariss commented 6 years ago

Hi, thanks for letting me know. I just fixed according to your recommendation.