From 542b87fd0af8207443581bae69c61e2f31a6fca9 Mon Sep 17 00:00:00 2001 From: sebasrivera96 Date: Fri, 18 May 2018 09:20:51 +0200 Subject: [PATCH] Update saveLevels function to add an extension just when needed --- labelImg.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/labelImg.py b/labelImg.py index c891eb45..01b6ea69 100755 --- a/labelImg.py +++ b/labelImg.py @@ -768,10 +768,14 @@ class MainWindow(QMainWindow, WindowMixin): # Can add differrent annotation formats here try: if self.usingPascalVocFormat is True: + if str(annotationFilePath[-4:]) != ".xml": + annotationFilePath += XML_EXT print ('Img: ' + self.filePath + ' -> Its xml: ' + annotationFilePath) self.labelFile.savePascalVocFormat(annotationFilePath, shapes, self.filePath, self.imageData, self.lineColor.getRgb(), self.fillColor.getRgb()) elif self.usingYoloFormat is True: + if annotationFilePath[-4:] != ".txt": + annotationFilePath += TXT_EXT print ('Img: ' + self.filePath + ' -> Its txt: ' + annotationFilePath) self.labelFile.saveYoloFormat(annotationFilePath, shapes, self.filePath, self.imageData, self.labelHist, self.lineColor.getRgb(), self.fillColor.getRgb())