File size: 750 Bytes
b8e6db2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#coding=utf-8 
import os
def text_create(name):
    Annotations_path = "/home/ricky/sh/phone_detect/data/phone/Annotations/"  # 创建的label文件的存放路径
    yolo_path="/home/ricky/sh/phone_detect/data/phone/labels/"
    full_Annotations_path =Annotations_path + name + '.xml'
    full_yolo_path = yolo_path + name + '.txt'
    file = open(full_yolo_path, 'w')
    file.close()
    file=open(full_Annotations_path, 'w')
    file.close()
 
 
IamgesPath = '/home/ricky/sh/phone_detect/data/phone/1_no_phone'          #负样本的地址
for i,j,k in os.walk(IamgesPath):
    for s in k:                                                       #其它图片格式稍微修改一下即可
        s=s[:-4]
        text_create(s)
        print(s)