回传数据解析,兼容v5和v10

This commit is contained in:
jiajie555
2025-04-18 14:41:53 +08:00
commit 010f5c445a
888 changed files with 93632 additions and 0 deletions

35
tracking/utils/rename.py Normal file
View File

@ -0,0 +1,35 @@
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 8 09:51:59 2024
@author: ym
"""
import os
def main():
directory = r'D:\DetectTracking\runs\detect'
directory = r'D:\DetectTracking\tracking\result\tracks'
suffix = '_'
for root, dirs, files in os.walk(directory):
for name in dirs:
old_name = os.path.join(root, name)
new_name = os.path.join(root, f"{name}{suffix}")
try:
os.rename(old_name, new_name)
except Exception as e:
print(f"Failed to rename directory '{old_name}': {e}")
for name in files:
old_name = os.path.join(root, name)
file, ext = os.path.splitext(name)
new_name = os.path.join(root, f"{file}{suffix}{ext}")
try:
os.rename(old_name, new_name)
except Exception as e:
print(f"Failed to rename file '{old_name}': {e}")
if __name__ == "__main__":
main()