From 9b469860fa081a5d003032c176bb341e483b5ebc Mon Sep 17 00:00:00 2001 From: vd <> Date: Fri, 9 Sep 2022 22:29:25 +0300 Subject: [PATCH] update --- .model_inference.py.swp | Bin 16384 -> 16384 bytes model_inference.py | 11 ++++++----- requirements.txt | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.model_inference.py.swp b/.model_inference.py.swp index 99574fe82639cb0fe8abfa31eae5499249fb8999..3a9217935323b6c4d1cc12adb8ece2fc4079320d 100644 GIT binary patch delta 280 zcmZo@U~Fh$R7f%i^Ym4)&@*BH0s#hw#vbY9gW`FNA`2K9QZjQBCoWXk=yHaiv39bc zfI4ICW=nz7{JcPQ3<^vT4YivE75W+L7qc=j)Btfc5W51g3lKkIVPJR&#Jhob1`uZf zu{98D0kI|!GXn8$W(I~`K->+))}Ay3yk6Ckn`u7xW=59NT${IAd$Rxlo4h%n delta 266 zcmZo@U~Fh$R7f%i^Ym4)&@*BH0s#hwIUUl;FU9j1wdOK1q-5qMPF$$6(d7(3W6fki z0d>Zj&6WbE`FZ7mYPFdl8frERD)ckfFJWb1s0HF0Aa(;{S0KK_!oYAFh_?dqBp^-! zVpAYi0b*q!{=&?_ump$~193GFn*y;35c2}@ccAg#fOrZJPX^*3AO>043B(;h+z!NT zK->z%EldpD49!4B6A(8tO_o>Em>i+>c=B%L{K?kJ4U@H0j&bNG=jWBA=9NtTsIqtS TdR0sA&CD!kxi)XL_GSS9pSw6V diff --git a/model_inference.py b/model_inference.py index 5999039b..1cdc7a6c 100644 --- a/model_inference.py +++ b/model_inference.py @@ -96,12 +96,12 @@ model_embedding.load_state_dict(torch.load('./embedding-output/model_embedding.p model_embedding.to(device) model_embedding.eval() -with open('/model_classifier.obj','rb') as file: +with open('./model_classifier.obj','rb') as file: model_classifier = pickle.load(file) classes = model_classifier.__getstate__()['classes_'] -video = Path('/content/test_videos_2022/2022-NLS-5-NLS_05_2022_Heli_UHD_01-000140-000155-Karussell.mp4') +video = Path('./test_videos_2022/2022-NLS-5-NLS_05_2022_Heli_UHD_01-000140-000155-Karussell.mp4') reader = cv2.VideoCapture(str(video)) fps = reader.get(cv2.CAP_PROP_FPS) @@ -109,18 +109,19 @@ w = int(reader.get(cv2.CAP_PROP_FRAME_WIDTH)) h = int(reader.get(cv2.CAP_PROP_FRAME_HEIGHT)) reader.release() -imgsz = check_img_size((w, h), s=model.stride) -dataset = LoadImages(video, img_size=imgsz, stride=model.stride, auto=model.pt) - weights_path = Path('./yolov5/best.pt') model = DetectMultiBackend(weights_path, device=torch.device(device)) +imgsz = check_img_size((w, h), s=model.stride) +dataset = LoadImages(video, img_size=imgsz, stride=model.stride, auto=model.pt) + save_dir = Path('./detection-output/') os.makedirs(save_dir) writer = cv2.VideoWriter(str(save_dir / 'res.mp4'), cv2.VideoWriter_fourcc(*'mp4v'), fps, (w, h)) for frame_n, (path, im, im0s, vid_cap, s) in enumerate(dataset): + print(frame_n) im = torch.from_numpy(im).to(device) im = im.half() if model.fp16 else im.float() # uint8 to fp16/32 im /= 255 # 0 - 255 to 0.0 - 1.0 diff --git a/requirements.txt b/requirements.txt index 7795139c..7eb91235 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ gdown +seaborn torch torchvision sklearn