-
Notifications
You must be signed in to change notification settings - Fork 277
why can not import own datasets? #312
Comments
Thanks for trying out Classy Vision! For a python decorator to work, the file it is in needs to be imported. In classy vision we do this in the init.py files. See for example here, this means we only need to add:
to our training script to automatically register everything in that folder as we add datasets. You'll need to import your new dataset in the training script which you can do with a direct import or with an import all statement like in the above example. I will also update the tutorial to make this clearer. Thanks for bringing it up! |
Thanks a lot, I copy code into classy_vision/dataset/ , it worked. |
@MagicSen glad you like the design! Also, you don't need to update the library to get your dataset to work. If you follow the instructions to set up your own project as per the links that follow, you can just move your dataset code to
If you just want to use a dataset without creating a project for some reason, make sure you do Let us know if you have any trouble with this. |
@MagicSen: as Mannat mentioned above, |
I solved this by allowing the necessary imports to be configured from the configuration itself e.g. config.json {
"imports": [
"mymodule.datasets",
"mymodule.models"
]
// add rest of classy vision config here
} main.py import json
import importlib
def parse_config(config_file):
with open(config_file, 'r') as f:
config = json.load(f)
import_modules(config)
return config
def import_modules(config):
for import_str in config.get("imports", []):
importlib.import_module(import_str) |
Follow the https://classyvision.ai/tutorials/classy_dataset,
I create own dataset reader, like this
but when i use this in config file, the program can't not find this.
how to fix this?
The text was updated successfully, but these errors were encountered: