first commit

This commit is contained in:
hatcher committed 2026-07-17 18:55:31 +08:00
1 parent ae53e9eac5
commit 91cbd01126
514 files changed
+55625 -2203

No files matched your search

+7 -4
View File
@@ -53,7 +53,7 @@ def VocToFineWithLabel(num_count,root_path,image_T):
ymin = object_id.getElementsByTagName('bndbox')[0].getElementsByTagName('ymin')[0].childNodes[0].data
xmax = object_id.getElementsByTagName('bndbox')[0].getElementsByTagName('xmax')[0].childNodes[0].data
ymax = object_id.getElementsByTagName('bndbox')[0].getElementsByTagName('ymax')[0].childNodes[0].data
name = object_id.getElementsByTagName('name')[0].childNodes[0].data
name = "bird"#object_id.getElementsByTagName('name')[0].childNodes[0].data
ratio_x = (3840.0/3840.0)
ratio_y = (2160.0/2160.0)
#print(ratio_x," ",ratio_y)
@@ -65,7 +65,10 @@ def VocToFineWithLabel(num_count,root_path,image_T):
ymax = int(float(ymax)*ratio_y)
if ((xmax - xmin)<image_T) | ((ymax - ymin)<image_T):
continue
img1 = cv2_crop(img,(xmin, ymin,xmax, ymax))
try:
img1 = cv2_crop(img,(xmin, ymin,xmax, ymax))
except:
print(xml_file)
if not os.path.exists(os.path.join(root_path.replace("Annotations","FineDataset_{}".format(str(image_T))),str(name).replace("\t","").strip())):
os.makedirs(os.path.join(root_path.replace("Annotations","FineDataset_{}".format(str(image_T))),str(name).replace("\t","").strip()))
cv2.imwrite(os.path.join(root_path.replace("Annotations","FineDataset_{}".format(str(image_T))),str(name).replace("\t","").strip(),"{}.jpg".format(str(num_count).zfill(5))), img1)
@@ -84,9 +87,9 @@ if __name__ == '__main__':
parser1.add_argument("image_T", default='0001', type=str,
help='Video name.')
parser1.add_argument("root_path", default='5', type=str,
help='GPU.')
help='Annotations')
args = parser1.parse_args()
num_count = 0
VocToFineWithLabel(num_count,args.root_path, int(args.image_T))
VocToFineWithLabel(num_count, args.root_path, int(args.image_T))