Deci-AI / super-gradients

Easily train or fine-tune SOTA computer vision models with one open source training library. The home of Yolo-NAS.
https://www.supergradients.com
Apache License 2.0
4.54k stars 496 forks source link

How does class_inclusion_list actually work? #1264

Closed DarshnaZE closed 1 year ago

DarshnaZE commented 1 year ago

💡 Your Question

dataset_params = { 'data_dir':'/home/dataset/aquarium_dataset', 'train_images_dir':'train/images', 'train_labels_dir':'train/labels', 'val_images_dir':'valid/images', 'val_labels_dir':'valid/labels', 'classes': ['fish', 'jellyfish', 'penguin', 'puffin', 'shark', 'starfish', 'stingray'], 'class_inclusion_list': ['fish', 'jellyfish'] }

train_data = coco_detection_yolo_format_train( dataset_params={ 'data_dir': dataset_params['data_dir'], 'images_dir': dataset_params['train_images_dir'], 'labels_dir': dataset_params['train_labels_dir'], 'classes': dataset_params['classes'], 'class_inclusion_list': dataset_params['class_inclusion_list'] }, dataloader_params={ 'batch_size':16, 'num_workers':2 } )

i have a dataset with 7 classes, out of which i want to finetune and train yolonas object detection model over only 2 classes, while still want to include the images of other classes during training. so that the model can learn what to exclude as well.

but when following the tutorial https://github.com/Deci-AI/super-gradients/tree/3.1.1/tutorials/SuperGradients How To Use a model to Predict.ipynb, i end up with the error image

Please note, the labels files of remaining classes are still there in training data.

Versions

No response

shaydeci commented 1 year ago

Hey @DarshnaZE, thank you for opening this issue. It seems that we have some kwargs with duplicated purposes (all_classes_list and classes). We will introduce a fix which will be included in the upcoming release. In the meanwhile, can you please check whether passing the "classes" also through the keyword argument 'all_classes_list' solves the problem?

BloodAxe commented 1 year ago

Fixed in https://github.com/Deci-AI/super-gradients/pull/1327 Will be part of 3.2.0 release

DarshnaZE commented 1 year ago

@BloodAxe thank You. Waiting for that...