[Question for Video Classification] Registering my custom dataset
Closed this issue · 4 comments
Hi, I'm back again with another issue :).
My goal is to finetune the UniFormer to my custom video dataset.
For this, I need to prepare a proper Pytorch dataset class like in slowfast/datasets/kinetics.py
first. But, I met a registry issue for my dataset.
I followed issue #149 in FAIR's slowfast github, but in my case, since I prepared my dataset in Kinetics-400
format, duplicated and retouched kinetics.py
.
I'm wasting much time solving this :s ... but, I have no idea which point I missed.
My process is as below.
Step1. Copy kinetics.py
and Rename it into my custom dataset
For example, suppose my dataset name is Boho, I change 1) the python script name and 2) the class name
kinetics.py
→boho.py
.Class Kinetics(...)
→Class Boho(...)
UniFormer/video_classification/slowfast/datasets/kinetics.py
Lines 20 to 33 in fdc1a64
Step2. Adding the line from .boho import Boho
to the __init__.py
file in the same folder.
UniFormer/video_classification/slowfast/datasets/__init__.py
Lines 4 to 10 in fdc1a64
Step3. Rebuild the slowfast package
~$ python setup.py build develop
Step4. Assign TRAIN.DATASET = 'boho'
in config.yaml
I learned that the decorator @DATASET_REGISTRY.register()
is to register my data object into fvcore
Registry
, but still is not yet.
Can you give me feedback on which part I missed?
I believe you have followed the right steps since I also register datasets like you here.
You can try to print the dataset names via the followed codes and check the bug...
print(DATASET_REGISTRY)
Actually, the step3 can be ignored. The repo does not need to be rebuilt.
Okay, I found out the problem. That was related to the python path issue.
I duplicated another slowfast
project and the dataset registry scoped that workspace where there is not my custom dataset.
After making it ignoring that path, everything works well :) thank.
By the way, you are doing another interesting project. I would also check it later!
Thanks for your sharing
Thanks for your reply. Don't forget to add PYTHONPATH when running your experiment.
Hi, i have same problem, please, help me @DoranLyong.
These step I have done.
1 Create file: MyDataset.py, copy from Kinetics.py
2 add this in init.py
from .custom_data import MyDataset
3 edit in config.yaml
and this is architecture data
DATASET: mydataset
mydataset
-a01
-a02
-a03
-a04
-a05
-a06
-a07
-a08
-a09
-a10
-train.csv
-test.csv
-val.csv