|
10 | 10 | from opencv_tools import * |
11 | 11 | from xml.dom import minidom |
12 | 12 | from dataset_tools import * |
| 13 | +from opencv_tools import * |
13 | 14 | def GetXmlClassesNames(xml_path): |
14 | 15 | classnames = [] |
15 | 16 | # Read the XML annotation file. |
@@ -261,6 +262,20 @@ def video_to_voc(self,save_path,detector=None,fps=5): |
261 | 262 | index = index + 1 |
262 | 263 | processBar.update() |
263 | 264 |
|
| 265 | +def paddle_pretrain_detection_dataset(root_path,detector,threshold=0.6): |
| 266 | + image_path = os.path.join(root_path,DIRECTORY_IMAGES) |
| 267 | + save_anno_path = CreateSavePath(os.path.join(root_path,DIRECTORY_ANNOTATIONS)) |
| 268 | + image_path_list = GetAllImagesPath(os.path.join(image_path)) |
| 269 | + processBar = ProgressBar(len(image_path_list)) |
| 270 | + for image_path in image_path_list: |
| 271 | + file_name = GetLastDir(image_path).split(".")[0] |
| 272 | + image = ReadChinesePath(image_path) |
| 273 | + result = detector.predict(image,threshold) |
| 274 | + if result["labels"][0] == -1: |
| 275 | + GenerateXml(file_name,image.shape,[],[],save_anno_path) |
| 276 | + else: |
| 277 | + GenerateXml(file_name,image.shape,result["boxes"],result["labels"],save_anno_path) |
| 278 | + processBar.update() |
264 | 279 |
|
265 | 280 | if __name__ == '__main__': |
266 | 281 | jadeVOCDatasets = JadeVOCDatasets(r'F:\数据集\VOC数据集\定制版顶相机箱号检测数据集') |
|
0 commit comments