Spaces:
Runtime error
Runtime error
Commit
·
ee9362f
1
Parent(s):
a697d26
Update detect_frames.py
Browse files- scripts/detect_frames.py +6 -7
scripts/detect_frames.py
CHANGED
@@ -38,27 +38,26 @@ def main(args, config={}, verbose=True):
|
|
38 |
|
39 |
print(config)
|
40 |
|
41 |
-
dirname = args.frames
|
42 |
-
|
43 |
model, device = setup_model(args.weights)
|
44 |
|
45 |
locations = [
|
46 |
-
"
|
47 |
]
|
48 |
for loc in locations:
|
49 |
|
50 |
-
in_loc_dir = os.path.join(
|
51 |
out_loc_dir = os.path.join(args.output, loc)
|
52 |
print(in_loc_dir)
|
53 |
print(out_loc_dir)
|
54 |
|
55 |
-
|
56 |
|
57 |
-
detect_location(in_loc_dir, out_loc_dir, config, model, device, seq_list, verbose)
|
58 |
|
59 |
|
60 |
def detect_location(in_loc_dir, out_loc_dir, config, model, device, seq_list, verbose):
|
61 |
|
|
|
|
|
62 |
with tqdm(total=len(seq_list), desc="...", ncols=0) as pbar:
|
63 |
for seq in seq_list:
|
64 |
|
@@ -118,7 +117,7 @@ def detect(in_dir, config, model, device, verbose):
|
|
118 |
confs = pred[:, 4].clone().tolist()
|
119 |
scale_boxes(image_shape, boxes, original_shape[0], original_shape[1]) # to original shape
|
120 |
|
121 |
-
frame = [ [*bb, conf
|
122 |
|
123 |
file_name = file_names[batch_i*32 + si]
|
124 |
for ann in frame:
|
|
|
38 |
|
39 |
print(config)
|
40 |
|
|
|
|
|
41 |
model, device = setup_model(args.weights)
|
42 |
|
43 |
locations = [
|
44 |
+
"kenai-val"
|
45 |
]
|
46 |
for loc in locations:
|
47 |
|
48 |
+
in_loc_dir = os.path.join(args.frames, loc)
|
49 |
out_loc_dir = os.path.join(args.output, loc)
|
50 |
print(in_loc_dir)
|
51 |
print(out_loc_dir)
|
52 |
|
53 |
+
detect_location(in_loc_dir, out_loc_dir, config, model, device, verbose)
|
54 |
|
|
|
55 |
|
56 |
|
57 |
def detect_location(in_loc_dir, out_loc_dir, config, model, device, seq_list, verbose):
|
58 |
|
59 |
+
seq_list = os.listdir(in_loc_dir)
|
60 |
+
|
61 |
with tqdm(total=len(seq_list), desc="...", ncols=0) as pbar:
|
62 |
for seq in seq_list:
|
63 |
|
|
|
117 |
confs = pred[:, 4].clone().tolist()
|
118 |
scale_boxes(image_shape, boxes, original_shape[0], original_shape[1]) # to original shape
|
119 |
|
120 |
+
frame = [ [*bb, conf] for bb, conf in zip(boxes.tolist(), confs) ]
|
121 |
|
122 |
file_name = file_names[batch_i*32 + si]
|
123 |
for ann in frame:
|