Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 667 when trying to save accuracy of each class #28

Open
mmitchef opened this issue Jun 21, 2022 · 0 comments
Open

KeyError: 667 when trying to save accuracy of each class #28

mmitchef opened this issue Jun 21, 2022 · 0 comments

Comments

@mmitchef
Copy link

I am trying to save accuracy of each class using the below script
python train_googlenet.py -data_path CelebA -balance_classes -batch_size 64 -num_epochs 1000 -optimizer sgd -freeze_to conv1 -data_mean 92.1754,109.4887,143.2121 -data_sd 60.3302,63.6089,73.3 -save_epoch 50 -output_name bvlc_conv1/bvlc_out.pth -individual_acc -save_csv -csv_dir bvlc_conv1

But, it gave me following error. Do you have any idea where this error is coming from? Thanks

Total 30026 images, split into 1000 classes
Classes:
 {'CA1': 0, 'CA10': 1, 'CA100': 2, 'CA1000': 3, 'CA1001': 4, 'CA101': 5, 'CA102': 6, 'CA103': 7, 'CA104': 8, 'CA105': 9, 'CA106': 10, 'CA107': 11, 'CA108': 12, 'CA109': 13, 'CA11': 14, 'CA110': 15, 'CA111': 16, 'CA112': 17, 'CA113': 18, 'CA114': 19, '$
Model has 13,378,280 learnable parameters

Epoch 1/1000
------------
train Loss: 11.0882 Acc: 0.0009
  Class Acc: {0: 47.62, 1: 0.0, 2: 0.0, 3: 0.0, 4: 0.0, 5: 0.0, 6: 0.0, 7: 0.0, 8: 0.0, 9: 0.0, 10: 0.0, 11: 0.0, 12: 0.0, 13: 0.0, 14: 0.0, 15: 0.0, 16: 0.0, 17: 0.0, 18: 0.0, 19: 0.0, 20: 0.0, 21: 0.0, 22: 0.0, 23: 0.0, 24: 0.0, 25: 0.0, 26: 0.0, 27$
  Time Elapsed 1m 45s
Traceback (most recent call last):
  File "./dream-creator-master/train_googlenet.py", line 171, in <module>
    main()
  File "./dream-creator-master/train_googlenet.py", line 51, in main
    main_func(params)
  File "./dream-creator-master/train_googlenet.py", line 163, in main_func
    train_model(model=cnn, dataloaders=training_data, criterion=criterion, optimizer=optimizer, lrscheduler=lrscheduler, \
  File "./dream-creator-master/utils/train_model.py", line 72, in train_model
    class_acc[c_val] = (class_acc[c_val].item() / data_counts[phase][c_val]) * 100
KeyError: 667
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant