dataloop-ai / dtlpy

Python SDK and CLI for Dataloop Platform
Apache License 2.0
16 stars 15 forks source link

support conversion of split annotations #31

Open KivutiBrian opened 2 years ago

KivutiBrian commented 2 years ago

I was trying to execute the from_coco method under the converter class, but it raised an error '400', 'unable to convert.Converter does not support split annotations: 1'

How can I solve this ?

IraData11 commented 2 years ago

Hi, @KivutiBrian thank you for reaching out. We don't support it yet, but we have added this request to our roadmap. Let us know if you have any questions.

KivutiBrian commented 2 years ago

Would you help with guide on how to implement that on my own? I really need to perform that conversion.

IraData11 commented 2 years ago

@KivutiBrian

What you can try is to upload that annotation as a segmentation mask as it seems that your coco annotations might have multiple polygons inside a single annotation.

Please follow the link: https://github.com/dataloop-ai/dtlpy-converters

If you will run into any issues please attach your annotations and we will be able to debug on our end.

KivutiBrian commented 2 years ago

@IraData11

Here is my sample coco-json file that I need to convert to dataloop format https://gist.github.com/KivutiBrian/b4b0af9088a102cdc41043a480eb38e9

IraData11 commented 2 years ago

Hi @KivutiBrian we have checked your json with the new converter and it works as expected. Please try to use the example below.

https://github.com/dataloop-ai/dtlpy-converters

from dataloop.converters import coco import dtlpy as dl import asyncio

conv = coco.CocoToDataloop() dataset = dl.datasets.get(dataset_id='dataset_id') annotation_filepath = "/home/coco/sample-coco.json" images_path = "/home/coco/images"

loop = asyncio.get_event_loop() loop.run_until_complete(conv.convert_dataset(upload_images=True, annotation_filepath=annotation_filepath, dataset=dataset, images_path=images_path))

KivutiBrian commented 2 years ago

I've tried using the example you have shared, but I get tons of errors.

loop.run_until_complete(conv.convert_dataset(upload_images=False, File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete return future.result() File "/home/gaideh/Documents/DDD_PROJECTS/dtlpy-converters/dataloop/converters/coco/coco_converters.py", line 128, in convert_dataset **await self.on_dataset( File "/home/gaideh/Documents/DDD_PROJECTS/dtlpy-converters/dataloop/converters/coco/coco_converters.py", line 143, in on_dataset json_path = Path(self.to_path) File "/usr/lib/python3.8/pathlib.py", line 1042, in __new__ self = cls._from_parts(args, init=False) File "/usr/lib/python3.8/pathlib.py", line 683, in _from_parts drv, root, parts = self._parse_args(args) File "/usr/lib/python3.8/pathlib.py", line 667, in _parse_args a = os.fspath(a) TypeError: expected str, bytes or os.PathLike object, not NoneType

KivutiBrian commented 2 years ago

To explain the context of my problem, the coco json is from another platform, and I would like to convert it into dataloop format and upload into dataloop platform

I've tried using the example you have shared, but I get tons of errors.

loop.run_until_complete(conv.convert_dataset(upload_images=False, File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete return future.result() File "/home/gaideh/Documents/DDD_PROJECTS/dtlpy-converters/dataloop/converters/coco/coco_converters.py", line 128, in convert_dataset **await self.on_dataset( File "/home/gaideh/Documents/DDD_PROJECTS/dtlpy-converters/dataloop/converters/coco/coco_converters.py", line 143, in on_dataset json_path = Path(self.to_path) File "/usr/lib/python3.8/pathlib.py", line 1042, in __new__ self = cls._from_parts(args, init=False) File "/usr/lib/python3.8/pathlib.py", line 683, in _from_parts drv, root, parts = self._parse_args(args) File "/usr/lib/python3.8/pathlib.py", line 667, in _parse_args a = os.fspath(a) TypeError: expected str, bytes or os.PathLike object, not NoneType

IraData11 commented 2 years ago

Thank you for the update. We are currently reviewing your case and will update once have more insights.

orshabtay commented 2 years ago

Hi @KivutiBrian , are you trying the DataloopToCoco or the CocoToDataloop? because the script we shared is using the CocoToDataloop but your error seems to come from the opposite way. if you want to use DataloopToCoco you are missing a "to_path" parameter which if None, gives the error you got.

KivutiBrian commented 2 years ago

I am trying, cocoToDataloop. And the coco is from a different platform.