custom data
hongjianyuan opened this issue · comments
How to use custom data?What needs to be modified?
Thanks
Hi @hongjianyuan,
In order to train with your custom data, you need to make the following changes on the code:
- Add an extra
dataset_name
case here https://github.com/valeoai/obow/blob/main/obow/datasets.py#L266 for your custom data. E.g.:
if dataset_name == "ImageNet":
dataset_train, dataset_test = get_ImageNet_data_for_obow(data_dir, **kwargs)
elif dataset_name == "MyCustomData":
dataset_train, dataset_test = get_MyCustom_data_for_obow(data_dir, **kwargs)
else:
raise NotImplementedError(f"Not supported dataset {dataset_name}")
- Implement the
get_MyCustom_data_for_obow()
function insidedataset.py
that should be exactly like the existingget_ImageNet_data_for_obow()
function with the only difference being that this point https://github.com/valeoai/obow/blob/main/obow/datasets.py#L238 you should load your own custom data. - You should create an new config file like the
config/ImageNetFull/ResNet50_OBoW_full.yaml
(https://github.com/valeoai/obow/blob/main/config/ImageNetFull/ResNet50_OBoW_full.yaml) but:
3.a Leave thenum_classes
field empty here https://github.com/valeoai/obow/blob/main/config/ImageNetFull/ResNet50_OBoW_full.yaml#L18
3.b Specify in thedataset_name
field your custom data https://github.com/valeoai/obow/blob/main/config/ImageNetFull/ResNet50_OBoW_full.yaml#L35