OML-Team / open-metric-learning

Metric learning and retrieval pipelines, models and zoo.
https://open-metric-learning.readthedocs.io/en/latest/index.html
Apache License 2.0
868 stars 62 forks source link

Pipeline of CUB dataset #364

Closed nik-fedorov closed 1 year ago

nik-fedorov commented 1 year ago

Hello! I tried to launch training and validation pipeline of CUB dataset. I have 2 questions. Firstly, I launched training with the following code:

import yaml

with open("train_cub.yaml") as f:
     data = yaml.safe_load(f)

data['dataframe_name'] = 'df.csv'
data['dataset_root'] = '/kaggle/working/CUB_200_2011'
data['num_workers'] = 2
data['bs_val'] = 128

with open("train_cub.yaml", "w") as f:
    yaml.dump(data, f)

!python train_cub.py

During training, validation CMC@1 slightly increased for approximately 600 epochs, reached the value of 0.73. But then it started to decrease. When 1300 epochs were passed, CMC@1 was approximately 0.7. From main github page of OML I know that CMC@1 for this CUB pipeline should be 0.837. So, my first question is what I'm doing wrong with training?

Secondly, I have an issue with validation. My code is:

import yaml

with open("val_cub.yaml") as f:
     data = yaml.safe_load(f)

data['dataframe_name'] = 'df.csv'
data['dataset_root'] = '/kaggle/working/CUB_200_2011'
data['num_workers'] = 2
data['bs_val'] = 128

with open("val_cub.yaml", "w") as f:
    yaml.dump(data, f)

!python validate_cub.py

but the output of this code is photo_5371071021756566178_x It seems that CMC@1 is significantly lower than 0.837.

Could you help me with these problems? Thanks a lot!

AlekseySh commented 1 year ago

Hi, @nik-fedorov! First of all, thank you for using OML!

I believe the issue is related to the fact that you don't use bounding boxes. If you check the config for the pre-trained model, you can see, that the name of the data frame is df_with_bboxes.csv: https://github.com/OML-Team/open-metric-learning/blob/main/pipelines/features_extraction/extractor_cub/val_cub.yaml#L6.

Just run the converter one more time, but remove the no-bboxes flag.