sovit-123 / fasterrcnn-pytorch-training-pipeline

PyTorch Faster R-CNN Object Detection on Custom Dataset
MIT License
223 stars 75 forks source link

Feature Request: Add support for a testing set. #82

Closed aymuos15 closed 1 year ago

aymuos15 commented 1 year ago

Can you add support to test on a test set as well? Not only validation and training?

Thanks!

sovit-123 commented 1 year ago

@aymuos15 Actually, it has support for that. In the dataset YAML file you can give the path to the test images and labels as well. If that happens, executing train.py will use the training and validation set whereas executing eval.py will use the test set. Here is an example if such a YAML file.

# Images and labels direcotry should be relative to train.py
TRAIN_DIR_IMAGES: '../input/trash_icra_xml/images/train'
TRAIN_DIR_LABELS: '../input/trash_icra_xml/labels/train'
VALID_DIR_IMAGES: '../input/trash_icra_xml/images/valid'
VALID_DIR_LABELS: '../input/trash_icra_xml/labels/valid'
TEST_DIR_IMAGES: '../input/trash_icra_xml/images/test'
TEST_DIR_LABELS: '../input/trash_icra_xml/labels/test'

# Class names.
CLASSES: [
    '__background__',
    'plastic', 'bio', 'rov'
]

# Number of classes (object classes + 1 for background class in Faster RCNN).
NC: 4

# Whether to save the predictions of the validation set while training.
SAVE_VALID_PREDICTION_IMAGES: True

Apologies that it's not clear right away from the README. I will update this.

aymuos15 commented 1 year ago

Sounds Perfect. Thank you!