Save an annotation file when there is no ROI
This commit is contained in:
+1
-4
@@ -41,16 +41,13 @@ class LabelFile(object):
|
||||
1 if image.isGrayscale() else 3]
|
||||
writer = PascalVocWriter(imgFolderName, imgFileNameWithoutExt,
|
||||
imageShape, localImgPath=imagePath)
|
||||
bSave = False
|
||||
for shape in shapes:
|
||||
points = shape['points']
|
||||
label = shape['label']
|
||||
bndbox = LabelFile.convertPoints2BndBox(points)
|
||||
writer.addBndBox(bndbox[0], bndbox[1], bndbox[2], bndbox[3], label)
|
||||
bSave = True
|
||||
|
||||
if bSave:
|
||||
writer.save(targetFile=filename)
|
||||
writer.save(targetFile=filename)
|
||||
return
|
||||
|
||||
@staticmethod
|
||||
|
||||
@@ -35,8 +35,7 @@ class PascalVocWriter:
|
||||
# Check conditions
|
||||
if self.filename is None or \
|
||||
self.foldername is None or \
|
||||
self.imgSize is None or \
|
||||
len(self.boxlist) <= 0:
|
||||
self.imgSize is None:
|
||||
return None
|
||||
|
||||
top = Element('annotation')
|
||||
|
||||
Reference in New Issue
Block a user