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

+44
View File
@@ -0,0 +1,44 @@
import os,argparse,torch
from System_I import Detection_Y5,Fine_grained_T
from tqdm import tqdm
#os.environ['CUDA_VISIBLE_DEVICES'] = "1"
if __name__ == '__main__':
parser1 = argparse.ArgumentParser(description="AILabel")
parser1.add_argument("--RawPath", default='/data/DataManagement/Project/temp/OrginalData', type=str,
help='RawPath.')
parser1.add_argument("--GPU", default="2", type=str,
help='GPU.')
parser1.add_argument("--thresh", default=0.4, type=float,
help='thresh.')
args = parser1.parse_args()
os.environ['CUDA_VISIBLE_DEVICES'] = args.GPU#"1"
try:
if "imagesAILabel" not in args.RawPath:
exit()
else:
os.system("sudo chmod 777 -R {}".format(str(args.RawPath).replace("imagesAILabel","")))
except:
exit()
#devices = torch.device('cuda:{}'.format(str(int(args.GPU))) if torch.cuda.is_available() else 'cpu')
devices = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
Detection = Detection_Y5(device=devices, root=" ", detect_thresh=args.thresh)
FineGrained = Fine_grained_T(device=devices)
for RawPaths in os.listdir(args.RawPath):
RawPath = os.path.join(args.RawPath,RawPaths,"imagesAILabel")
if not os.path.exists(RawPath.replace("imagesAILabel","NoResult")):
os.makedirs(RawPath.replace("imagesAILabel","NoResult"))
if not os.path.exists(RawPath.replace("imagesAILabel","JPEGImages")):
os.makedirs(RawPath.replace("imagesAILabel","JPEGImages"))
if not os.path.exists(RawPath.replace("imagesAILabel","Annotations")):
os.makedirs(RawPath.replace("imagesAILabel","Annotations"))
if not os.path.exists(RawPath.replace("imagesAILabel", "BrokenImage")):
os.makedirs(RawPath.replace("imagesAILabel", "BrokenImage"))
imagepaths = os.listdir(RawPath)
for imagepath in tqdm(imagepaths):
imagepath = os.path.join(args.RawPath,imagepath)
Detection.AIlabelFine(imagepath,FineGrained)