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

Potential Datumaro Bug ( And Solution ) #1494

Closed
mashrurmorshed opened this issue May 5, 2020 · 3 comments · Fixed by #1352
Closed

Potential Datumaro Bug ( And Solution ) #1494

mashrurmorshed opened this issue May 5, 2020 · 3 comments · Fixed by #1352
Assignees
Labels
bug Something isn't working

Comments

@mashrurmorshed
Copy link

mashrurmorshed commented May 5, 2020

Hello. I opened a prior issue here for getting annotations of unannotated images: #1350 . The solution was very precise and simple, but there seemed to be a problem. I could export the project in other formats but not cvat, which kept throwing an error. Here's the trace:

(restenv) mashrur@dealer-hp:~/This_PC/Work/datumaro-sandbox/test_project_0$ datum project export -f cvat
2020-05-06 00:31:42,240 ERROR: init() missing 1 required positional argument: 'self'
Traceback (most recent call last):
File "/home/mashrur/anaconda3/envs/restenv/bin/datum", line 8, in
sys.exit(main())
File "/home/mashrur/anaconda3/envs/restenv/lib/python3.6/site-packages/datumaro/cli/main.py", line 156, in main
return args.command(args)
File "/home/mashrur/anaconda3/envs/restenv/lib/python3.6/site-packages/datumaro/cli/contexts/project/init.py", line 310, in export_command
extra_args = converter.from_cmdline(args.extra_args)
File "/home/mashrur/anaconda3/envs/restenv/lib/python3.6/site-packages/datumaro/components/cli_plugin.py", line 36, in from_cmdline
parser = cls.build_cmdline_parser()
File "/home/mashrur/anaconda3/envs/restenv/lib/python3.6/site-packages/datumaro/plugins/cvat_format/converter.py", line 373, in build_cmdline_parser
parser = super().init(**kwargs)
TypeError: init() missing 1 required positional argument: 'self'

It works fine for exporting in other formats like voc, coco or datumaro. Since I had a manual workaround, I didn't spend much time on reviewing this, but sometime back I returned to this problem to see if I could figure out what's wrong. build_cmdline_parser isn't taking self and thus calling super().__init()__ in it is a bit strange. After checking out the superclasses of the CvatConverter I figured out a fix:

This is from datumaro>plugins>cvat_format>converter.py:

class CvatConverter(Converter, CliPlugin):
    @classmethod
    def build_cmdline_parser(cls, **kwargs):
        parser = super().__init__(**kwargs)
        parser.add_argument('--save-images', action='store_true',
            help="Save images (default: %(default)s)")
        return parser

If we change the above to:

class CvatConverter(Converter, CliPlugin):
    @classmethod
    def build_cmdline_parser(cls, **kwargs):
        parser = super().build_cmdline_parser(**kwargs) #super().__init__(**kwargs)
        parser.add_argument('--save-images', action='store_true',
            help="Save images (default: %(default)s)")
        return parser

Now it works fine and exports in cvat format as I wanted.

(restenv) mashrur@dealer-hp:~/This_PC/Work/datumaro-sandbox/test_project_0$ datum project export -f cvat
2020-05-06 00:47:06,574 INFO: Loading the project...
2020-05-06 00:47:06,575 INFO: Exporting the project...
2020-05-06 00:47:06,579 INFO: Project exported to '/home/mashrur/This_PC/Work/datumaro-sandbox/test_project_0/test_project_0-cvat' as 'cvat'

I'm not sure if this is a bug (it could be some problem with my installation/environment?), so I'm again opening an issue to get your opinion on this. If this is indeed a bug, then should I open a pull request?

@mashrurmorshed
Copy link
Author

Also referencing #1488 here as this solves that too.

@zhiltsov-max zhiltsov-max self-assigned this May 5, 2020
@zhiltsov-max zhiltsov-max added the bug Something isn't working label May 5, 2020
@zhiltsov-max zhiltsov-max added this to To do in Dataset framework (Datumaro) via automation May 5, 2020
@zhiltsov-max zhiltsov-max linked a pull request May 5, 2020 that will close this issue
9 tasks
@zhiltsov-max
Copy link
Contributor

Hi, thanks for the report. This problem is already going to be fixed with #1352.

@mashrurmorshed
Copy link
Author

Alright then, I'll close the issue. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

2 participants