joheras / CLoDSA

124 stars 32 forks source link

The number of images is different to the number of annotations #61

Open sudenursenkal opened 2 years ago

sudenursenkal commented 2 years ago

Hello, I want to augment my dataset using the code "Augmenting a dataset for object detection in YOLO". However, I am getting the following error during "Applying the augmentation process". I have multiple label boxes on an image in my dataset. So there is more than one data in xml file too. Can't I use Clodsa on this dataset?

Exception Traceback (most recent call last) in () ----> 1 augmentor.applyAugmentation()

1 frames /usr/local/lib/python3.7/dist-packages/clodsa/augmentors/yoloLinearDetectionAugmentor.py in applyAugmentation(self) 86 87 def applyAugmentation(self): ---> 88 self.readImagesAndAnnotations() 89 if not(os._exists(self.outputPath)): 90 os.makedirs(self.outputPath)

/usr/local/lib/python3.7/dist-packages/clodsa/augmentors/yoloLinearDetectionAugmentor.py in readImagesAndAnnotations(self) 83 self.labelPaths = list(paths.list_files(self.inputPath,validExts=(".txt"))) 84 if (len(self.imagePaths) != len(self.labelPaths)): ---> 85 raise Exception("The number of images is different to the number of annotations") 86 87 def applyAugmentation(self):

Exception: The number of images is different to the number of annotations

EDIT: I found the solution. The problem was that the existing jpg-png files in the folder were together and the file named classes.txt was skipped. The problem was solved by running the jpg and their txt files separately. :)

joheras commented 2 years ago

Hi,

Could you share with me a notebook with your problem so I can try to reproduce the error?

Best, Jónathan

El sáb, 7 may 2022 a las 14:35, sudenursenkal @.***>) escribió:

Hello, I want to augment my dataset using the code "Augmenting a dataset for object detection in YOLO". However, I am getting the following error during "Applying the augmentation process". I have multiple label boxes on an image in my dataset. So there is more than one data in xml file too. Can't I use Clodsa on this dataset?

Exception Traceback (most recent call last) https://localhost:8080/# in () ----> 1 augmentor.applyAugmentation()

1 frames

/usr/local/lib/python3.7/dist-packages/clodsa/augmentors/yoloLinearDetectionAugmentor.py https://localhost:8080/# in applyAugmentation(self) 86 87 def applyAugmentation(self): ---> 88 self.readImagesAndAnnotations() 89 if not(os._exists(self.outputPath)): 90 os.makedirs(self.outputPath)

/usr/local/lib/python3.7/dist-packages/clodsa/augmentors/yoloLinearDetectionAugmentor.py https://localhost:8080/# in readImagesAndAnnotations(self) 83 self.labelPaths = list(paths.list_files(self.inputPath,validExts=(".txt"))) 84 if (len(self.imagePaths) != len(self.labelPaths)): ---> 85 raise Exception("The number of images is different to the number of annotations") 86 87 def applyAugmentation(self):

Exception: The number of images is different to the number of annotations

When I running to that step "Finally, we can check the amount of images in the output folder." (without running the "Applying the augmentation process" step), I get the following error.

Number of images in the folder ls: cannot access 'augmented_images_yolo/

.jpg': No such file or directory 0 Number of annotations in the folder ls: cannot access 'augmented_images_yolo/.txt': No such file or directory 0

The file looks empty and that's why the file I downloaded as a zip is empty. What should I do?

— Reply to this email directly, view it on GitHub https://github.com/joheras/CLoDSA/issues/61, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJRAG2JBUBK7F6SVRGFAH3VIZPQNANCNFSM5VKLSCGA . You are receiving this because you are subscribed to this thread.Message ID: @.***>