forked from lozuwa/impy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathObjectDetectionDatasetPreprocessMethods.py
executable file
·48 lines (43 loc) · 1.61 KB
/
ObjectDetectionDatasetPreprocessMethods.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"""
package: Images2Dataset
class: ImageLocalizationDatasetPreprocessMethods
Author: Rodrigo Loza
Description: Preprocess methods for the ImageLocalization
class.
"""
# Libraries
from interface import Interface
class ObjectDetectionDatasetPreprocessMethods(Interface):
def dataConsistency(self):
"""
Checks whether data is consistent. It starts analyzing if there is the same amount of
of images and annotations. Then it sees if the annotations and images are consistent
with each other.
Args:
None
Returns:
None
Raises:
- Exception: when the extension of the image is not allowed. Only jpgs and pngs are allowed.
- Exception: When an annotation file does not have a .xml extension.
- Exception: When the amount of annotations and images is not equal.
- Exception: When there are images that don't have annotations.
- Exception: When there are annotations that don't have images.
"""
pass
def findEmptyOrWrongAnnotations(self, removeEmpty = None):
"""
Find empty or irregular annotations in the annotation files. An empty
annotation is an annotation that includes no objects. And a irregular
annotation is an annotation that has a bounding box with coordinates that
are off the image's boundaries.
Args:
removeEmpty: A boolean that if True removes the annotation and image that are empty.
Returns:
None
Raises:
- Exception: when the extension of the image is not allowed. Only jpgs and pngs are allowed.
- Exception: when an annotation file is empty.
- Exception: when a coordinate is not valid. Either less than zero or greater than image's size.
"""
pass