Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The iter_from_dir that usesjson.load in method convert_to_voc does not open the json file. #241

Open
keithleungwork opened this issue Sep 5, 2023 · 0 comments

Comments

@keithleungwork
Copy link

As the title stated, the method iter_from_json_file (link) is using the json_file string directly. It caused error because json.load is expecting a file object.

# one task
if data_type == 'dict':
    data = json.load(json_file)
    for item in self.annotation_result_from_task(data):
        yield item

If you scroll down a bit, you will see another block using the json_file correctly

# many tasks
elif data_type == 'list':
    with io.open(json_file, 'rb') as f:
        logger.debug(f'ijson backend in use: {ijson.backend}')
        data = ijson.items(
            f, 'item', use_float=True
        )  # 'item' means to read array of dicts

Should I open create a PR and fix this ? because I am using this library for conversion task. Otherwise I have to manually clone all the code to create my own version...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant