joheras / CLoDSA

124 stars 32 forks source link

Error augmenting COCO Dataset #46

Open ghost opened 3 years ago

ghost commented 3 years ago

I am using this snippet of code to augment a dataset:

augmentor = createAugmentor("detection", "coco", "coco", "linear", "/content/train", {"outputPath": "/content/train_new"})
transformer = transformerGenerator("detection")

for angle in [45, 90, 135, 180]:
    rotate = createTechnique("rotate", {"angle": angle})
    augmentor.addTransformer(transformer(rotate))

for i in [1, -1]:
    flip = createTechnique("flip", {"flip": i})
    augmentor.addTransformer(transformer(flip))

crop = createTechnique("crop", {"percentage": 0.7, "startFrom": "TOPLEFT"})
augmentor.addTransformer(transformer(crop))

blur = createTechnique("blurring", {"ksize": 5})
augmentor.addTransformer(transformer(blur))

augmentor.applyAugmentation()

I am getting an error:

TypeError                                 Traceback (most recent call last)
<ipython-input-6-c9fb2524c1cf> in <module>()
     12     augmentor.addTransformer(transformer(flip))
     13 
---> 14 augmentor.applyAugmentation()

5 frames
/usr/local/lib/python3.7/dist-packages/clodsa/augmentors/cocoLinearDetectionAugmentor.py in applyAugmentation(self)
     63                                              (self.outputPath, self.transformers, self.imagesPath, self.dictImages[x],
     64                                               self.dictAnnotations[x],self.ignoreClasses)
---> 65                                              for x in self.dictImages.keys())
     66         data = {}
     67         data['info'] = self.info

/usr/local/lib/python3.7/dist-packages/joblib/parallel.py in __call__(self, iterable)
   1052 
   1053             with self._backend.retrieval_context():
-> 1054                 self.retrieve()
   1055             # Make sure that we get a last message telling us we are done
   1056             elapsed_time = time.time() - self._start_time

/usr/local/lib/python3.7/dist-packages/joblib/parallel.py in retrieve(self)
    931             try:
    932                 if getattr(self._backend, 'supports_timeout', False):
--> 933                     self._output.extend(job.get(timeout=self.timeout))
    934                 else:
    935                     self._output.extend(job.get())

/usr/local/lib/python3.7/dist-packages/joblib/_parallel_backends.py in wrap_future_result(future, timeout)
    540         AsyncResults.get from multiprocessing."""
    541         try:
--> 542             return future.result(timeout=timeout)
    543         except CfTimeoutError as e:
    544             raise TimeoutError from e

/usr/lib/python3.7/concurrent/futures/_base.py in result(self, timeout)
    433                 raise CancelledError()
    434             elif self._state == FINISHED:
--> 435                 return self.__get_result()
    436             else:
    437                 raise TimeoutError()

/usr/lib/python3.7/concurrent/futures/_base.py in __get_result(self)
    382     def __get_result(self):
    383         if self._exception:
--> 384             raise self._exception
    385         else:
    386             return self._result

TypeError: function takes exactly 4 arguments (2 given)
ghost commented 3 years ago

I am on Colab, using my own dataset.

ghost commented 3 years ago

It works fine in your colab notebook, but my dataset is also in coco format only and I have done everything properly.

ghost commented 3 years ago

You can check out the dataset I am using:

!curl -L "https://app.roboflow.com/ds/DhuSCIiIGA?key=Mq2JJ2oTFd" > roboflow.zip; unzip roboflow.zip; rm roboflow.zip

The annotations file is named _annotations.coco.json so I rename it to annotations.json:

!mv /content/train/_annotations.coco.json /content/train/annotations.json

That's all. I don't get why it doesn't work. I've given you all the details I could think of.

joheras commented 3 years ago

I have fixed the error in a new version of Clodsa. You have a running example with your code at: https://colab.research.google.com/drive/1R3e5TtBTlY8Kgqe2-S6B3W0XgBC37z20?usp=sharing Best, Jónathan

El lun, 30 ago 2021 a las 9:11, BleepLogger @.***>) escribió:

You can check out the dataset I am using:

!curl -L "https://app.roboflow.com/ds/DhuSCIiIGA?key=Mq2JJ2oTFd" > roboflow.zip; unzip roboflow.zip; rm roboflow.zip

The annotations file is named _annotations.coco.json so I rename it to annotations.json:

!mv /content/train/_annotations.coco.json /content/train/annotations.json

That's all. I don't get why it doesn't work. I've given you all the details I could think of.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/joheras/CLoDSA/issues/46#issuecomment-908092199, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJRAGZ54GN4EF55XX7LBELT7MVI5ANCNFSM5DBG5CWA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

ghost commented 3 years ago

I'm sorry, but the dataset generated by the new version of Clodsa is seriously flawed.

joheras commented 3 years ago

What do you mean?

El mar, 31 ago 2021 a las 8:10, BleepLogger @.***>) escribió:

I'm sorry, but the dataset generated by the new version of Clodsa is seriously flawed.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/joheras/CLoDSA/issues/46#issuecomment-908930295, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJRAG73D3A5S7MPSYX6GGDT7RW6NANCNFSM5DBG5CWA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.