collages comparison scripts
Browse files
scripts/collage_comparison/.gitignore
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
*.mp4
|
2 |
+
|
scripts/collage_comparison/cfg.yaml
CHANGED
@@ -8,7 +8,7 @@ default_learned_parameters:
|
|
8 |
device: ${oc.env:VRE_DEVICE,cpu}
|
9 |
|
10 |
default_compute_parameters:
|
11 |
-
batch_size:
|
12 |
|
13 |
representations:
|
14 |
rgb:
|
|
|
8 |
device: ${oc.env:VRE_DEVICE,cpu}
|
9 |
|
10 |
default_compute_parameters:
|
11 |
+
batch_size: 1
|
12 |
|
13 |
representations:
|
14 |
rgb:
|
scripts/collage_comparison/vre.sh
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
set -ex
|
3 |
+
video_file=$1
|
4 |
+
shift
|
5 |
+
vre_gpu_parallel $video_file --gpus $@ -- --config_path /scratch/sdc/datasets/dronescapes-2024/scripts/collage_comparison/cfg.yaml -o data_${video_file} --representations semantic_mask2former_coco_47429163_0 semantic_mask2former_mapillary_49189528_0 semantic_mask2former_mapillary_49189528_1 depth_marigold "normals_svd(depth_marigold)" semantic_mask2former_swin_mapillary_converted semantic_mask2former_r50_mapillary_converted semantic_mask2former_swin_coco_converted semantic_median_expert buildings "buildings(nearby)" containing rgb safe-landing-no-sseg safe-landing-semantics sky-and-water transportation vegetation -I /export/home/proiecte/aux/mihai_cristian.pirvu/code/neo-transformers/readers/semantic_mapper.py:get_new_semantic_mapped_tasks --output_dir_exists_mode skip_computed
|
scripts/collage_comparison/wip.ipynb
ADDED
The diff for this file is too large to render.
See raw diff
|
|
scripts/collage_comparison/wip.py
CHANGED
@@ -126,9 +126,6 @@ def main(args: Namespace):
|
|
126 |
frames = list(range(*map(int, args.frames.split(".."))))
|
127 |
|
128 |
(vre_dir := Path.cwd() / f"data_{video_path.name}").mkdir(exist_ok=True)
|
129 |
-
assert (vre_dir / "rgb").exists(), vre_dir
|
130 |
-
for frame in frames:
|
131 |
-
assert (vre_dir / f"rgb/npz/{frame}.npz").exists(), frame
|
132 |
cfg_path = Path(__file__).parent / "cfg.yaml"
|
133 |
assert cfg_path.exists(), cfg_path
|
134 |
# frames = sorted(map(str, set([random.randint(0, N) for _ in range(5)])))
|
@@ -144,12 +141,17 @@ def main(args: Namespace):
|
|
144 |
# "-I", f"{Path.cwd().parents[1]}/readers/semantic_mapper.py:get_new_semantic_mapped_tasks",
|
145 |
# "--output_dir_exists_mode", "skip_computed",
|
146 |
# ]
|
|
|
|
|
147 |
# frames = None#["5"]
|
148 |
# if frames is not None:
|
149 |
# args.extend(["--frames", *frames])
|
150 |
# # print(" ".join(args))
|
151 |
# subprocess.run(args=args, env={**os.environ.copy(), **{"VRE_DEVICE": "cuda" if tr.cuda.is_available() else "cpu", "CUDA_VISIBLE_DEVICES": "7"}})
|
152 |
|
|
|
|
|
|
|
153 |
weights_path = "/export/home/proiecte/aux/mihai_cristian.pirvu/code/neo-transformers/ckpts/safeuav/sema/mae-4M-ext/epoch=37-val_semantic_output_mean_iou=0.470.ckpt"
|
154 |
weights_path_dstil = "/export/home/proiecte/aux/mihai_cristian.pirvu/code/neo-transformers/ckpts/safeuav/distil2/sl0-4M-ext2-distil/epoch=24-val_semantic_output_mean_iou=0.472.ckpt"
|
155 |
|
|
|
126 |
frames = list(range(*map(int, args.frames.split(".."))))
|
127 |
|
128 |
(vre_dir := Path.cwd() / f"data_{video_path.name}").mkdir(exist_ok=True)
|
|
|
|
|
|
|
129 |
cfg_path = Path(__file__).parent / "cfg.yaml"
|
130 |
assert cfg_path.exists(), cfg_path
|
131 |
# frames = sorted(map(str, set([random.randint(0, N) for _ in range(5)])))
|
|
|
141 |
# "-I", f"{Path.cwd().parents[1]}/readers/semantic_mapper.py:get_new_semantic_mapped_tasks",
|
142 |
# "--output_dir_exists_mode", "skip_computed",
|
143 |
# ]
|
144 |
+
# print(" ".join(args))
|
145 |
+
# exit(0)
|
146 |
# frames = None#["5"]
|
147 |
# if frames is not None:
|
148 |
# args.extend(["--frames", *frames])
|
149 |
# # print(" ".join(args))
|
150 |
# subprocess.run(args=args, env={**os.environ.copy(), **{"VRE_DEVICE": "cuda" if tr.cuda.is_available() else "cpu", "CUDA_VISIBLE_DEVICES": "7"}})
|
151 |
|
152 |
+
assert (vre_dir / "rgb").exists(), vre_dir
|
153 |
+
for frame in frames:
|
154 |
+
assert (vre_dir / f"rgb/npz/{frame}.npz").exists(), frame
|
155 |
weights_path = "/export/home/proiecte/aux/mihai_cristian.pirvu/code/neo-transformers/ckpts/safeuav/sema/mae-4M-ext/epoch=37-val_semantic_output_mean_iou=0.470.ckpt"
|
156 |
weights_path_dstil = "/export/home/proiecte/aux/mihai_cristian.pirvu/code/neo-transformers/ckpts/safeuav/distil2/sl0-4M-ext2-distil/epoch=24-val_semantic_output_mean_iou=0.472.ckpt"
|
157 |
|
scripts/collage_comparison/wip.sh
CHANGED
@@ -20,13 +20,14 @@ trap cleanup SIGINT SIGTERM
|
|
20 |
|
21 |
for ((i=0; i<n_gpus; i++)); do
|
22 |
start_frame=$((i * frames_per_gpu))
|
23 |
-
end_frame=$((start_frame + frames_per_gpu
|
24 |
|
25 |
# Ensure the last partition captures all remaining frames
|
26 |
if [[ $i -eq $((n_gpus - 1)) ]]; then
|
27 |
-
end_frame=$
|
28 |
fi
|
29 |
|
|
|
30 |
CUDA_VISIBLE_DEVICES=${gpu_indices[$i]} ./wip.py $video_file --frames $start_frame..$end_frame &
|
31 |
done
|
32 |
|
@@ -34,4 +35,4 @@ done
|
|
34 |
wait
|
35 |
|
36 |
# Combine output frames into a video using ffmpeg
|
37 |
-
ffmpeg -framerate $fps -i
|
|
|
20 |
|
21 |
for ((i=0; i<n_gpus; i++)); do
|
22 |
start_frame=$((i * frames_per_gpu))
|
23 |
+
end_frame=$((start_frame + frames_per_gpu))
|
24 |
|
25 |
# Ensure the last partition captures all remaining frames
|
26 |
if [[ $i -eq $((n_gpus - 1)) ]]; then
|
27 |
+
end_frame=$n_frames
|
28 |
fi
|
29 |
|
30 |
+
echo "CUDA_VISIBLE_DEVICES=${gpu_indices[$i]} ./wip.py $video_file --frames $start_frame..$end_frame &"
|
31 |
CUDA_VISIBLE_DEVICES=${gpu_indices[$i]} ./wip.py $video_file --frames $start_frame..$end_frame &
|
32 |
done
|
33 |
|
|
|
35 |
wait
|
36 |
|
37 |
# Combine output frames into a video using ffmpeg
|
38 |
+
ffmpeg -framerate $fps -i out_"$video_file"/%d.jpg -c:v libx265 -pix_fmt yuv420p out_"$video_file"/collage.mp4
|