| #!/bin/bash |
| |
| |
|
|
| |
| cd "$(dirname "$0")" |
|
|
| |
| mkdir -p results |
|
|
| echo "ROI-VAE Compression Examples" |
| echo "=============================" |
| echo |
|
|
| |
| |
| |
| echo "1. CAR (YOLO)" |
| echo "-------------" |
|
|
| |
| echo "a) Compressing (Image Only)..." |
| python roi_compressor.py \ |
| --input data/images/car/0016cf15fa4d4e16.jpg \ |
| --output results/car_compressed.jpg \ |
| --checkpoint checkpoints/tic_lambda_0.0483.pth.tar \ |
| --sigma 0.3 \ |
| --seg-method yolo \ |
| --seg-classes car |
|
|
| |
| echo "b) Compressing (With Comparison)..." |
| python roi_compressor.py \ |
| --input data/images/car/0016cf15fa4d4e16.jpg \ |
| --output results/car_comparison.jpg \ |
| --checkpoint checkpoints/tic_lambda_0.0483.pth.tar \ |
| --sigma 0.3 \ |
| --seg-method yolo \ |
| --seg-classes car \ |
| --highlight |
|
|
| echo |
| echo "---------------------------------------------------------" |
| echo |
|
|
| |
| |
| |
| echo "2. BUILDING (SegFormer)" |
| echo "-----------------------" |
|
|
| |
| echo "a) Compressing (Image Only)..." |
| python roi_compressor.py \ |
| --input data/images/building/000571767ec7a593.jpg \ |
| --output results/building_compressed.jpg \ |
| --checkpoint checkpoints/tic_lambda_0.0483.pth.tar \ |
| --sigma 0.3 \ |
| --seg-classes building |
|
|
| |
| echo "b) Compressing (With Comparison)..." |
| python roi_compressor.py \ |
| --input data/images/building/000571767ec7a593.jpg \ |
| --output results/building_comparison.jpg \ |
| --checkpoint checkpoints/tic_lambda_0.0483.pth.tar \ |
| --sigma 0.3 \ |
| --seg-classes building \ |
| --highlight |
|
|
| echo |
| echo "---------------------------------------------------------" |
| echo |
|
|
| |
| |
| |
| echo "3. PERSON (YOLO)" |
| echo "----------------" |
|
|
| |
| echo "a) Compressing (Image Only)..." |
| python roi_compressor.py \ |
| --input data/images/person/kodim04.png \ |
| --output results/person_compressed.jpg \ |
| --checkpoint checkpoints/tic_lambda_0.0483.pth.tar \ |
| --sigma 0.3 \ |
| --seg-method yolo \ |
| --seg-classes person |
|
|
| |
| echo "b) Compressing (With Comparison)..." |
| python roi_compressor.py \ |
| --input data/images/person/kodim04.png \ |
| --output results/person_comparison.jpg \ |
| --checkpoint checkpoints/tic_lambda_0.0483.pth.tar \ |
| --sigma 0.3 \ |
| --seg-method yolo \ |
| --seg-classes person \ |
| --highlight |
|
|
| echo |
| echo "---------------------------------------------------------" |
| echo |
|
|
| |
| |
| |
| echo "4. BOAT (YOLO)" |
| echo "--------------" |
|
|
| |
| echo "a) Compressing (Image Only)..." |
| python roi_compressor.py \ |
| --input data/images/boat/kodim06.png \ |
| --output results/boat_compressed.jpg \ |
| --checkpoint checkpoints/tic_lambda_0.0483.pth.tar \ |
| --sigma 0.3 \ |
| --seg-method yolo \ |
| --seg-classes boat |
|
|
| |
| echo "b) Compressing (With Comparison)..." |
| python roi_compressor.py \ |
| --input data/images/boat/kodim06.png \ |
| --output results/boat_comparison.jpg \ |
| --checkpoint checkpoints/tic_lambda_0.0483.pth.tar \ |
| --sigma 0.3 \ |
| --seg-method yolo \ |
| --seg-classes boat \ |
| --highlight |
|
|
| echo |
| echo "---------------------------------------------------------" |
| echo |
|
|
| |
| |
| |
| echo "5. PARAMETER COMPARISON" |
| echo "-----------------------" |
|
|
| |
| echo "a) Sigma Comparison (Background Quality)..." |
| |
| echo " - Low Sigma (0.1)" |
| python roi_compressor.py \ |
| --input data/images/car/0016cf15fa4d4e16.jpg \ |
| --output results/sigma_low.jpg \ |
| --checkpoint checkpoints/tic_lambda_0.0483.pth.tar \ |
| --sigma 0.1 \ |
| --seg-method yolo \ |
| --seg-classes car \ |
| --highlight |
|
|
| |
| echo " - High Sigma (0.9)" |
| python roi_compressor.py \ |
| --input data/images/car/0016cf15fa4d4e16.jpg \ |
| --output results/sigma_high.jpg \ |
| --checkpoint checkpoints/tic_lambda_0.0483.pth.tar \ |
| --sigma 0.9 \ |
| --seg-method yolo \ |
| --seg-classes car \ |
| --highlight |
|
|
| |
| echo "b) Lambda Comparison (Rate-Distortion)..." |
| |
| echo " - Low Lambda (0.013)" |
| python roi_compressor.py \ |
| --input data/images/car/0016cf15fa4d4e16.jpg \ |
| --output results/lambda_low.jpg \ |
| --checkpoint checkpoints/tic_lambda_0.013.pth.tar \ |
| --sigma 0.3 \ |
| --lambda 0.013 \ |
| --N 128 \ |
| --M 192 \ |
| --seg-method yolo \ |
| --seg-classes car \ |
| --highlight |
|
|
| |
| echo " - High Lambda (0.0932)" |
| python roi_compressor.py \ |
| --input data/images/car/0016cf15fa4d4e16.jpg \ |
| --output results/lambda_high.jpg \ |
| --checkpoint checkpoints/tic_lambda_0.0932.pth.tar \ |
| --sigma 0.3 \ |
| --lambda 0.0932 \ |
| --seg-method yolo \ |
| --seg-classes car \ |
| --highlight |
|
|
| echo |
| echo "---------------------------------------------------------" |
| echo |
|
|
| |
| |
| |
| echo "--- Running Standalone Segmentation (Mask R-CNN) ---" |
| python roi_segmenter.py \ |
| --input images/car/0016cf15fa4d4e16.jpg \ |
| --output results/mask_rcnn.png \ |
| --method maskrcnn \ |
| --classes car \ |
| --visualize |
|
|
| |
| |
| |
| echo "--- Running Video Compression (Static Mode) ---" |
| python roi_compressor.py \ |
| --input data/videos/traffic.mp4 \ |
| --output results/video_static.mp4 \ |
| --quality-level 4 \ |
| --sigma 0.4 \ |
| --seg-method yolo \ |
| --seg-classes car person \ |
| --video-mode static \ |
| --output-fps 10 |
|
|
| |
| |
| |
| echo "--- Running Video Compression (Dynamic Mode) ---" |
| python roi_compressor.py \ |
| --input data/videos/traffic.mp4 \ |
| --output results/video_dynamic.mp4 \ |
| --quality-level 4 \ |
| --seg-method yolo \ |
| --seg-classes car person \ |
| --video-mode dynamic \ |
| --target-bandwidth-kbps 800 \ |
| --min-fps 5 \ |
| --max-fps 20 |
|
|
| |
| |
| |
| echo "--- Running Video Detection Evaluation (Static Mode) ---" |
| python roi_detection_eval.py \ |
| --before data/videos/traffic.mp4 \ |
| --video-mode static \ |
| --sigma 0.3 \ |
| --output-fps 10 \ |
| --quality-level 4 \ |
| --seg-method yolo \ |
| --seg-classes car person \ |
| --detectors yolo \ |
| --max-video-frames 30 \ |
| --video-sample-interval 3 \ |
| --save-after results/video_eval_compressed.mp4 \ |
| --out results/video_detection_eval.json \ |
| --viz-dir results/video_detection_viz |
|
|
| |
| |
| |
| echo "--- Running Video Detection Evaluation (Compare Two Videos) ---" |
| python roi_detection_eval.py \ |
| --before data/videos/traffic.mp4 \ |
| --after results/video_static.mp4 \ |
| --detectors yolo \ |
| --max-video-frames 30 \ |
| --video-sample-interval 3 \ |
| --out results/video_compare_eval.json |
|
|
| echo |
| echo "=============================" |
| echo "All examples complete! Check results/ directory" |
|
|