Update saveLevels function to add an extension just when needed

This commit is contained in:
sebasrivera96 2018-05-18 09:20:51 +02:00 committed by darrenl
parent 96c723c139
commit 542b87fd0a

View File

@ -768,10 +768,14 @@ class MainWindow(QMainWindow, WindowMixin):
# Can add differrent annotation formats here # Can add differrent annotation formats here
try: try:
if self.usingPascalVocFormat is True: if self.usingPascalVocFormat is True:
if str(annotationFilePath[-4:]) != ".xml":
annotationFilePath += XML_EXT
print ('Img: ' + self.filePath + ' -> Its xml: ' + annotationFilePath) print ('Img: ' + self.filePath + ' -> Its xml: ' + annotationFilePath)
self.labelFile.savePascalVocFormat(annotationFilePath, shapes, self.filePath, self.imageData, self.labelFile.savePascalVocFormat(annotationFilePath, shapes, self.filePath, self.imageData,
self.lineColor.getRgb(), self.fillColor.getRgb()) self.lineColor.getRgb(), self.fillColor.getRgb())
elif self.usingYoloFormat is True: elif self.usingYoloFormat is True:
if annotationFilePath[-4:] != ".txt":
annotationFilePath += TXT_EXT
print ('Img: ' + self.filePath + ' -> Its txt: ' + annotationFilePath) print ('Img: ' + self.filePath + ' -> Its txt: ' + annotationFilePath)
self.labelFile.saveYoloFormat(annotationFilePath, shapes, self.filePath, self.imageData, self.labelHist, self.labelFile.saveYoloFormat(annotationFilePath, shapes, self.filePath, self.imageData, self.labelHist,
self.lineColor.getRgb(), self.fillColor.getRgb()) self.lineColor.getRgb(), self.fillColor.getRgb())