ankitdhall / learning_embeddings

Code for CVPR-W 2020 paper "Hierarchical Image Classification using Entailment Cone Embeddings" https://arxiv.org/abs/2004.03459

Home Page:https://ankitdhall.github.io/project/learning-representations-for-images-with-hierarchical-labels/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

KeyError: 'mannii'

nikste opened this issue · comments

When running

--experiment_name
test1
--experiment_dir
test1_dir
--image_dir
<path_to>/ETHEC_dataset_v0.2/ETHEC_dataset/IMAGO_build_test_resized
--n_epochs
10
--model
resnet50
--loss
multi_level
--set_mode
train 

it crashes with:

Traceback (most recent call last):
  File "learning_embeddings/network/ethec_experiments.py", line 473, in <module>
    ETHEC_train_model(args)
  File "learning_embeddings/network/ethec_experiments.py", line 361, in ETHEC_train_model
    sampler=None if arguments.class_weights else WeightedResampler(
  File "learning_embeddings/network/experiment.py", line 231, in __init__
    label_ids = [dataset[ind]['leaf_label'] for ind in range(len(dataset))]
  File "learning_embeddings/network/experiment.py", line 231, in <listcomp>
    label_ids = [dataset[ind]['leaf_label'] for ind in range(len(dataset))]
  File "learning_embeddings/data/db.py", line 3789, in __getitem__
    'labels': torch.from_numpy(self.labelmap.get_one_hot(sample['family'], sample['subfamily'], sample['genus'],
  File "learning_embeddings/data/db.py", line 1071, in get_one_hot
    retval[self.genus_specific_epithet[specific_epithet] + self.levels[0] + self.levels[1] + self.levels[2]] = 1
KeyError: 'mannii'

What am i doing wrong ?

The readme has been updated to clarify the usage. I hope that helps.

  • use v0.1 of the ETHEC dataset
  • use the Adam1x branch to run CNN-based models for the ETHEC dataset