This commit is contained in:
yatenglg 2023-04-28 22:37:02 +08:00
parent febf35fc44
commit a82e3015bd
7 changed files with 60 additions and 18 deletions

View File

@ -263,7 +263,10 @@ class COCOConverter:
for obj in objects: for obj in objects:
object = {} object = {}
object['category'] = obj.get('category', '') object['category'] = obj.get('category', '')
object['group'] = groups_dict.get(obj.get('group', 0)) if 'background' in object['category']:
object['group'] = 0
else:
object['group'] = groups_dict.get(obj.get('group', 0))
object['segmentation'] = obj.get('segmentation', []) object['segmentation'] = obj.get('segmentation', [])
object['area'] = obj.get('area', None) object['area'] = obj.get('area', None)
object['layer'] = obj.get('layer', None) object['layer'] = obj.get('layer', None)

View File

@ -15,7 +15,7 @@ class Ui_Dialog(object):
def setupUi(self, Dialog): def setupUi(self, Dialog):
Dialog.setObjectName("Dialog") Dialog.setObjectName("Dialog")
Dialog.setWindowModality(QtCore.Qt.NonModal) Dialog.setWindowModality(QtCore.Qt.NonModal)
Dialog.resize(514, 202) Dialog.resize(600, 166)
font = QtGui.QFont() font = QtGui.QFont()
font.setFamily("Times New Roman") font.setFamily("Times New Roman")
font.setPointSize(12) font.setPointSize(12)
@ -49,6 +49,7 @@ class Ui_Dialog(object):
self.widget_3 = QtWidgets.QWidget(Dialog) self.widget_3 = QtWidgets.QWidget(Dialog)
self.widget_3.setObjectName("widget_3") self.widget_3.setObjectName("widget_3")
self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.widget_3) self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.widget_3)
self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.horizontalLayout_2.setObjectName("horizontalLayout_2")
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacerItem) self.horizontalLayout_2.addItem(spacerItem)
@ -59,6 +60,7 @@ class Ui_Dialog(object):
self.widget_4 = QtWidgets.QWidget(Dialog) self.widget_4 = QtWidgets.QWidget(Dialog)
self.widget_4.setObjectName("widget_4") self.widget_4.setObjectName("widget_4")
self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.widget_4) self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.widget_4)
self.horizontalLayout_3.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.horizontalLayout_3.setObjectName("horizontalLayout_3")
spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_3.addItem(spacerItem1) self.horizontalLayout_3.addItem(spacerItem1)
@ -97,13 +99,13 @@ class Ui_Dialog(object):
def retranslateUi(self, Dialog): def retranslateUi(self, Dialog):
_translate = QtCore.QCoreApplication.translate _translate = QtCore.QCoreApplication.translate
Dialog.setWindowTitle(_translate("Dialog", "ISAT to VOC png")) Dialog.setWindowTitle(_translate("Dialog", "COCO to ISAT"))
self.pushButton_save_root.setText(_translate("Dialog", "Save root")) self.pushButton_save_root.setText(_translate("Dialog", "Save root"))
self.pushButton_label_path.setText(_translate("Dialog", "Json path")) self.pushButton_label_path.setText(_translate("Dialog", "Json path"))
self.lineEdit_save_root.setPlaceholderText(_translate("Dialog", "ISAT jsons save root")) self.lineEdit_save_root.setPlaceholderText(_translate("Dialog", "ISAT jsons save root"))
self.lineEdit_label_path.setPlaceholderText(_translate("Dialog", "COCO json path")) self.lineEdit_label_path.setPlaceholderText(_translate("Dialog", "COCO json path"))
self.checkBox_keepcrowd.setText(_translate("Dialog", "Keep crowd")) self.checkBox_keepcrowd.setText(_translate("Dialog", "Keep crowd"))
self.label.setText(_translate("Dialog", "Convert COCO json to ISAT jsons.")) self.label.setText(_translate("Dialog", "Convert COCO json to ISAT jsons.All layer attr is 1."))
self.pushButton_cache.setText(_translate("Dialog", "cache")) self.pushButton_cache.setText(_translate("Dialog", "cache"))
self.pushButton_apply.setText(_translate("Dialog", "convert")) self.pushButton_apply.setText(_translate("Dialog", "convert"))
import icons_rc import icons_rc

View File

@ -9,8 +9,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>514</width> <width>600</width>
<height>202</height> <height>166</height>
</rect> </rect>
</property> </property>
<property name="font"> <property name="font">
@ -20,7 +20,7 @@
</font> </font>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>ISAT to VOC png</string> <string>COCO to ISAT</string>
</property> </property>
<property name="sizeGripEnabled"> <property name="sizeGripEnabled">
<bool>false</bool> <bool>false</bool>
@ -90,6 +90,18 @@
<item> <item>
<widget class="QWidget" name="widget_3" native="true"> <widget class="QWidget" name="widget_3" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item> <item>
<spacer name="horizontalSpacer_2"> <spacer name="horizontalSpacer_2">
<property name="orientation"> <property name="orientation">
@ -116,6 +128,18 @@
<item> <item>
<widget class="QWidget" name="widget_4" native="true"> <widget class="QWidget" name="widget_4" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item> <item>
<spacer name="horizontalSpacer_3"> <spacer name="horizontalSpacer_3">
<property name="orientation"> <property name="orientation">
@ -160,7 +184,7 @@
<string notr="true">color: rgb(255, 0, 0);</string> <string notr="true">color: rgb(255, 0, 0);</string>
</property> </property>
<property name="text"> <property name="text">
<string>Convert COCO json to ISAT jsons.</string> <string>Convert COCO json to ISAT jsons.All layer attr is 1.</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -15,7 +15,7 @@ class Ui_Dialog(object):
def setupUi(self, Dialog): def setupUi(self, Dialog):
Dialog.setObjectName("Dialog") Dialog.setObjectName("Dialog")
Dialog.setWindowModality(QtCore.Qt.NonModal) Dialog.setWindowModality(QtCore.Qt.NonModal)
Dialog.resize(508, 155) Dialog.resize(600, 137)
font = QtGui.QFont() font = QtGui.QFont()
font.setFamily("Times New Roman") font.setFamily("Times New Roman")
font.setPointSize(12) font.setPointSize(12)
@ -49,6 +49,7 @@ class Ui_Dialog(object):
self.widget_3 = QtWidgets.QWidget(Dialog) self.widget_3 = QtWidgets.QWidget(Dialog)
self.widget_3.setObjectName("widget_3") self.widget_3.setObjectName("widget_3")
self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.widget_3) self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.widget_3)
self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.horizontalLayout_2.setObjectName("horizontalLayout_2")
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacerItem) self.horizontalLayout_2.addItem(spacerItem)
@ -87,12 +88,12 @@ class Ui_Dialog(object):
def retranslateUi(self, Dialog): def retranslateUi(self, Dialog):
_translate = QtCore.QCoreApplication.translate _translate = QtCore.QCoreApplication.translate
Dialog.setWindowTitle(_translate("Dialog", "ISAT to VOC png")) Dialog.setWindowTitle(_translate("Dialog", "ISAT to COCO"))
self.pushButton_save_path.setText(_translate("Dialog", "Save path")) self.pushButton_save_path.setText(_translate("Dialog", "Save path"))
self.pushButton_label_root.setText(_translate("Dialog", "Jsons root")) self.pushButton_label_root.setText(_translate("Dialog", "Jsons root"))
self.lineEdit_save_path.setPlaceholderText(_translate("Dialog", "COCO json save path")) self.lineEdit_save_path.setPlaceholderText(_translate("Dialog", "COCO json save path"))
self.lineEdit_label_root.setPlaceholderText(_translate("Dialog", "ISAT jsons root")) self.lineEdit_label_root.setPlaceholderText(_translate("Dialog", "ISAT jsons root"))
self.label.setText(_translate("Dialog", "Convert ISAT jsons to COCO json.")) self.label.setText(_translate("Dialog", "Convert ISAT jsons to COCO json.The layer attr will be lost."))
self.pushButton_cache.setText(_translate("Dialog", "cache")) self.pushButton_cache.setText(_translate("Dialog", "cache"))
self.pushButton_apply.setText(_translate("Dialog", "convert")) self.pushButton_apply.setText(_translate("Dialog", "convert"))
import icons_rc import icons_rc

View File

@ -9,8 +9,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>508</width> <width>600</width>
<height>155</height> <height>137</height>
</rect> </rect>
</property> </property>
<property name="font"> <property name="font">
@ -20,7 +20,7 @@
</font> </font>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>ISAT to VOC png</string> <string>ISAT to COCO</string>
</property> </property>
<property name="sizeGripEnabled"> <property name="sizeGripEnabled">
<bool>false</bool> <bool>false</bool>
@ -90,6 +90,18 @@
<item> <item>
<widget class="QWidget" name="widget_3" native="true"> <widget class="QWidget" name="widget_3" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item> <item>
<spacer name="horizontalSpacer_2"> <spacer name="horizontalSpacer_2">
<property name="orientation"> <property name="orientation">
@ -134,7 +146,7 @@
<string notr="true">color: rgb(255, 0, 0);</string> <string notr="true">color: rgb(255, 0, 0);</string>
</property> </property>
<property name="text"> <property name="text">
<string>Convert ISAT jsons to COCO json.</string> <string>Convert ISAT jsons to COCO json.The layer attr will be lost.</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -15,7 +15,7 @@ class Ui_Dialog(object):
def setupUi(self, Dialog): def setupUi(self, Dialog):
Dialog.setObjectName("Dialog") Dialog.setObjectName("Dialog")
Dialog.setWindowModality(QtCore.Qt.NonModal) Dialog.setWindowModality(QtCore.Qt.NonModal)
Dialog.resize(509, 175) Dialog.resize(600, 173)
font = QtGui.QFont() font = QtGui.QFont()
font.setFamily("Times New Roman") font.setFamily("Times New Roman")
font.setPointSize(12) font.setPointSize(12)

View File

@ -9,8 +9,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>509</width> <width>600</width>
<height>175</height> <height>173</height>
</rect> </rect>
</property> </property>
<property name="font"> <property name="font">