!unzip game.zip
!mv game data/
#根据PaddlexX格式的要求,生成三个数据集
import os
import zipfile
import xml.etree.ElementTree as ET
import re
import numpy as np
lables = os.listdir("data/game/lable")
print("lables:",len(lables))
trains = os.listdir("data/game/train1")
print("trains:",len(trains))
_lable = []
ratio = 0.8
offset = int(len(lables)*ratio)
np.random.shuffle(lables)
path = "data/game/"
with open(path + "train_list.txt","w") as f:
for lable in lables[:offset]:
if lable.split(".")[0] + ".jpg" in trains:
f.w
本文地址:https://blog.csdn.net/txpp520/article/details/107873345
如对本文有疑问, 点击进行留言回复!!
【数据结构与算法Python描述】——字符串、元组、列表内存模型简介
用Python写一个属于自己的音乐播放器(pygame+tkinter)
网友评论