diff --git a/files/input/contr.mp4 b/files/input/contr.mp4 new file mode 100644 index 0000000..faa18e2 Binary files /dev/null and b/files/input/contr.mp4 differ diff --git a/win_venv/files/input/1611396369.mp4 b/win_venv/files/input/1611396369.mp4 new file mode 100644 index 0000000..eff7b52 Binary files /dev/null and b/win_venv/files/input/1611396369.mp4 differ diff --git a/win_venv/files/input/1611416115.mp4 b/win_venv/files/input/1611416115.mp4 new file mode 100644 index 0000000..c6d713e Binary files /dev/null and b/win_venv/files/input/1611416115.mp4 differ diff --git a/win_venv/files/input/contr.mp4 b/win_venv/files/input/contr.mp4 new file mode 100644 index 0000000..faa18e2 Binary files /dev/null and b/win_venv/files/input/contr.mp4 differ diff --git a/win_venv/files/input/contr_short.mp4 b/win_venv/files/input/contr_short.mp4 new file mode 100644 index 0000000..c6d713e Binary files /dev/null and b/win_venv/files/input/contr_short.mp4 differ diff --git a/win_venv/files/input/corner2.mp4 b/win_venv/files/input/corner2.mp4 new file mode 100644 index 0000000..eff7b52 Binary files /dev/null and b/win_venv/files/input/corner2.mp4 differ diff --git a/win_venv/files/output/contr.mp4 b/win_venv/files/output/contr.mp4 new file mode 100644 index 0000000..3625114 Binary files /dev/null and b/win_venv/files/output/contr.mp4 differ diff --git a/win_venv/files/output/corner2.mp4 b/win_venv/files/output/corner2.mp4 new file mode 100644 index 0000000..714bb15 Binary files /dev/null and b/win_venv/files/output/corner2.mp4 differ diff --git a/win_venv/files/output/exp2/1611396369.mp4 b/win_venv/files/output/exp2/1611396369.mp4 new file mode 100644 index 0000000..01b910a Binary files /dev/null and b/win_venv/files/output/exp2/1611396369.mp4 differ diff --git a/win_venv/files/output/exp3/1611396369.mp4 b/win_venv/files/output/exp3/1611396369.mp4 new file mode 100644 index 0000000..1da70cb Binary files /dev/null and b/win_venv/files/output/exp3/1611396369.mp4 differ diff --git a/win_venv/main.py b/win_venv/main.py index 08249e8..8fddc11 100644 --- a/win_venv/main.py +++ b/win_venv/main.py @@ -1,6 +1,6 @@ #import tkinter as tk import sys -import os +import os, subprocess import shutil from datetime import datetime import time @@ -18,9 +18,9 @@ LIB_VIS = 1 def files(path): - for file in os.listdir(path): - if os.path.isfile(os.path.join(path, file)): - yield file + for subdir, dirs, files_list in os.walk(path): + for file in files_list: + yield os.path.join(subdir, file) def save_input(oldpath): # make timestampt the filename, so it wouln't overwrite @@ -55,7 +55,11 @@ class LibraryTableButtons(QWidget): table.fillTable(type) def analyzeFile(): - # todo: run script detect.py --source ../files/input/file.mp4 + cmd = "py detect.py --source {} --view-img".format(str(file)) + + popen = subprocess.Popen(cmd, cwd="../yolov5/", stdout=subprocess.PIPE) + popen.wait() + # todo: display gif/spinning wheel pass layout = QHBoxLayout() @@ -115,9 +119,10 @@ class LibraryTable(QTableWidget): self.horizontalHeader().setSectionResizeMode(2, QHeaderView.ResizeToContents) dates = [] - names = [] + names = [] + for index, file in enumerate(files(filePath)): - dates.append(QTableWidgetItem(str(datetime.fromtimestamp(os.path.getmtime(filePath + '/' + file))))) + dates.append(QTableWidgetItem(str(datetime.fromtimestamp(os.path.getmtime(file))))) names.append(QTableWidgetItem(str(file))) self.setRowCount(len(dates)) @@ -125,7 +130,7 @@ class LibraryTable(QTableWidget): for index, date in enumerate(dates): self.setItem(index,0,date) self.setItem(index,1,names[index]) - self.setCellWidget(index,2,LibraryTableButtons(filePath + '\\' + names[index].text(), self, type)) + self.setCellWidget(index,2,LibraryTableButtons(names[index].text(), self, type)) class formatHelp(QLabel): diff --git a/yolov5/detect.py b/yolov5/detect.py index 99eb95c..5d31ad3 100644 --- a/yolov5/detect.py +++ b/yolov5/detect.py @@ -237,7 +237,7 @@ def detect(save_img=False): h = int(vid_cap.get(cv2.CAP_PROP_FRAME_HEIGHT)) vid_writer = cv2.VideoWriter(save_path, cv2.VideoWriter_fourcc(*fourcc), fps, (w, h)) vid_writer.write(im0) - + print(save_path) if save_txt or save_img: s = f"\n{len(list(save_dir.glob('labels/*.txt')))} labels saved to {save_dir / 'labels'}" if save_txt else '' print(f"Results saved to {save_dir}{s}") @@ -260,7 +260,7 @@ if __name__ == '__main__': parser.add_argument('--agnostic-nms', action='store_true', help='class-agnostic NMS') parser.add_argument('--augment', action='store_true', help='augmented inference') parser.add_argument('--update', action='store_true', help='update all models') - parser.add_argument('--project', default='../files/output', help='save results to project/name') + parser.add_argument('--project', default='../win_venv/files/output', help='save results to project/name') parser.add_argument('--name', default='exp', help='save results to project/name') parser.add_argument('--exist-ok', action='store_true', help='existing project/name ok, do not increment') parser.add_argument("--config_deepsort", type=str, default="deep_sort_pytorch/configs/deep_sort.yaml") diff --git a/yolov5/utils/datasets.py b/yolov5/utils/datasets.py index e2b139f..e3290bd 100644 --- a/yolov5/utils/datasets.py +++ b/yolov5/utils/datasets.py @@ -170,7 +170,8 @@ class LoadImages: # for inference ret_val, img0 = self.cap.read() self.frame += 1 - print('video %g/%g (%g/%g) %s: ' % (self.count + 1, self.nf, self.frame, self.nframes, path), end='') + # print('video %g/%g (%g/%g) %s: ' % (self.count + 1, self.nf, self.frame, self.nframes, path), end='') + print('video %g/%g (%g/%g) : ' % (self.count + 1, self.nf, self.frame, self.nframes), end='') else: # Read image