Save an annotation file when there is no ROI

This commit is contained in:
Thibaut Mattio
2017-02-28 13:18:26 +08:00
parent c5c2a34a39
commit 77d5fae05f
3 changed files with 15 additions and 30 deletions
+1 -4
View File
@@ -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
+1 -2
View File
@@ -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')