Closed amitkumar-delhivery closed 1 year ago
Hi,
could you send me the example that you are trying to execute?
It seems that is an error related to some of the images of your dataset, but I am not sure where.
@joheras I'm not authorised to share those images but I can describe it here, I've images of variable size ranging from (300x300) to (600x600) both images and labels are in .png
format. I also tried another method in which coco format is being put INPUT having annotations.json file and images , I've validated the directory structure used in collab examples also.
So, you want to apply the library in an instance segmentation problem, am I correct?
If you want to know the image that is producing the error, you can modify the function readAndGenerateImageSegmentation in the file clodsa/augmentors/folderLinearSemanticSegmentationAugmentor.py
(i, imagePath) = i_and_imagePath
print(imagePath)
image = cv2.imread(imagePath)
name = imagePath.split(os.path.sep)[-1]
labelPath = '/'.join(imagePath.split(os.path.sep)[:-2]) + "/labels/" + name[
0:name.rfind(".")] + labelextension
label = cv2.imread(labelPath)
for (j, transformer) in enumerate(transformers):
(newimage,newlabel) = transformer.transform(image,label)
cv2.imwrite(outputPath + "images/" + str(i) + "_" + str(j) + "_" + name,
newimage)
cv2.imwrite(outputPath + "labels/" + str(i) + "_" + str(j) + "_" + name[0:name.rfind(".")]+labelextension,
newlabel)
Could you produce a toy example with images that are not from your project that could be used to reproduce the error?
Hello,
I am currently working on an instance segmentation problem and I am having the exact same issue as @amitkumar-delhivery.
---------------------------------------------------------------------------
_RemoteTraceback Traceback (most recent call last)
_RemoteTraceback:
"""
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/joblib/externals/loky/process_executor.py", line 431, in _process_worker
r = call_item()
File "/usr/local/lib/python3.6/dist-packages/joblib/externals/loky/process_executor.py", line 285, in __call__
return self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.6/dist-packages/joblib/_parallel_backends.py", line 595, in __call__
return self.func(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/joblib/parallel.py", line 253, in __call__
for func, args, kwargs in self.items]
File "/usr/local/lib/python3.6/dist-packages/joblib/parallel.py", line 253, in <listcomp>
for func, args, kwargs in self.items]
File "/usr/local/lib/python3.6/dist-packages/clodsa/augmentors/cocoLinearInstanceSegmentationAugmentor.py", line 39, in readAndGenerateInstanceSegmentation
(newimage, newmasklabels) = transformer.transform(image, maskLabels)
File "/usr/local/lib/python3.6/dist-packages/clodsa/transformers/transformerForImageInstanceSegmentation.py", line 14, in transform
return [self.technique.apply(image),
File "/usr/local/lib/python3.6/dist-packages/clodsa/techniques/rotateAugmentationTechnique.py", line 52, in apply
rotated = self.__rotate_bound(image)
File "/usr/local/lib/python3.6/dist-packages/clodsa/techniques/rotateAugmentationTechnique.py", line 30, in __rotate_bound
(h, w) = image.shape[:2]
AttributeError: 'NoneType' object has no attribute 'shape'
"""
The above exception was the direct cause of the following exception:
AttributeError Traceback (most recent call last)
<ipython-input-24-1d9c8eaf67b6> in <module>()
----> 1 augmentor.applyAugmentation()
5 frames
/usr/local/lib/python3.6/dist-packages/clodsa/augmentors/cocoLinearInstanceSegmentationAugmentor.py in applyAugmentation(self)
88 (self.outputPath, self.transformers, self.imagesPath, self.dictImages[x],
89 self.dictAnnotations[x],self.ignoreClasses)
---> 90 for x in self.dictImages.keys())
91
92 data = {}
/usr/local/lib/python3.6/dist-packages/joblib/parallel.py in __call__(self, iterable)
1040
1041 with self._backend.retrieval_context():
-> 1042 self.retrieve()
1043 # Make sure that we get a last message telling us we are done
1044 elapsed_time = time.time() - self._start_time
/usr/local/lib/python3.6/dist-packages/joblib/parallel.py in retrieve(self)
919 try:
920 if getattr(self._backend, 'supports_timeout', False):
--> 921 self._output.extend(job.get(timeout=self.timeout))
922 else:
923 self._output.extend(job.get())
/usr/local/lib/python3.6/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.6/concurrent/futures/_base.py in result(self, timeout)
430 raise CancelledError()
431 elif self._state == FINISHED:
--> 432 return self.__get_result()
433 else:
434 raise TimeoutError()
/usr/lib/python3.6/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
AttributeError: 'NoneType' object has no attribute 'shape'
Perhaps the issue might be related to the joblib
package? I got the following warning after importing createAugmentor
, transformerGenerator
and createTechnique
.
/usr/local/lib/python3.6/dist-packages/sklearn/externals/joblib/__init__.py:15: FutureWarning: sklearn.externals.joblib is deprecated in 0.21 and will be removed in 0.23. Please import this functionality directly from joblib, which can be installed with: pip install joblib. If this warning is raised when loading pickled models, you may need to re-serialize those models with scikit-learn 0.21+.
I tried the same with the images from the shapes folder you used in your Colab notebook and there were no issues.
I am currently working on a very important project and your help would be much appreciated.
I have also inserted some images that I want to apply data augmentation to. They are 1080 x 1080 images.
Hi, I have updated the code of CLODSA and now it will show the image that produced the problem when executing that code. You need to install using pip the latest version:
pip install clodsa==1.2.41
Try that and let me know if this helps.
Sorry for not answering before but I was on vacation. You can also contact me by email if needed (joheras@gmail.com)
Best, Jónathan
Hello,
I am currently working on a semantic segmentation problem and I am having the exact same issue as @amitkumar-delhivery.
`---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
5 frames /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
AttributeError: 'NoneType' object has no attribute 'shape'`
Can you please help me to solve this problem?
Hi,
Could you send me a minimal example to reproduce the error? You can contact me by email: joheras@gmail.com.
Best, Jónathan
Hi,
Could you send me a minimal example to reproduce the error? You can contact me by email: joheras@gmail.com.
Best, Jónathan
Hi, I just sent you an email. Best regards, Antonietta
Even though I'm following all the steps mentioned in the colab but below issue mentioned below is still coming. Any help?