Initial commit: FishServer monorepo (FishAction, FishMeasure, fish_api)
Made-with: Cursor
This commit is contained in:
55
FishMeasure/run_predict_from_svo2.sh
Executable file
55
FishMeasure/run_predict_from_svo2.sh
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env bash
|
||||
# Fish step flags mirror run_fish_evaluation_simple.sh; weight = test_dgcnn via this script.
|
||||
# Iterates each fishXX folder under SESSION_ROOT (top-level *.svo2 per folder).
|
||||
# Layout: output_weight_estimator/<fish_name>/<svo_stem>/{cloud,images,weight_prediction.json,...}
|
||||
#
|
||||
# Weight aggregation (test_dgcnn_weight_estimator): per-PLY length = PCA major axis on raw points (mm);
|
||||
# final weight = mean of predicted_weight_g over the K longest PLYs (--weight-top-by-length --weight-top-k 5).
|
||||
# Without --weight-top-by-length, top-K would be by predicted weight instead of length.
|
||||
#
|
||||
# Requires bash (arrays, shopt, [[). If you run `sh this.sh`, dash will re-exec bash:
|
||||
if [ -z "${BASH_VERSION:-}" ]; then
|
||||
exec bash "$0" "$@"
|
||||
fi
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
SESSION_ROOT="/home/ubuntu/data/fish/2016-1-22-last"
|
||||
OUT_PARENT="output_weight_estimator"
|
||||
|
||||
shopt -s nullglob
|
||||
for fish_dir in "$SESSION_ROOT"/fish*/; do
|
||||
[[ -d "$fish_dir" ]] || continue
|
||||
svos=("$fish_dir"*.svo2)
|
||||
[[ ${#svos[@]} -gt 0 ]] || continue
|
||||
|
||||
fish_name="$(basename "${fish_dir%/}")"
|
||||
save_out="$OUT_PARENT/$fish_name"
|
||||
|
||||
echo ""
|
||||
echo "============================================================"
|
||||
echo " $fish_name (${#svos[@]} .svo2) → $save_out/<svo_stem>/"
|
||||
echo "============================================================"
|
||||
|
||||
python3 predict_weigth_from_svo2.py \
|
||||
--batch-svo-folder "$fish_dir" \
|
||||
--weight-checkpoint weight_estimator/runs/dgcnn_20260312_171043/best.pt \
|
||||
--save-output "$save_out" \
|
||||
--yolo-model "/home/ubuntu/projects/FishMeasure/runs/train/fish_detection_20251127_104658/weights/best.pt" \
|
||||
--conf 0.5 \
|
||||
--imgsz 640 \
|
||||
--sam-device cuda \
|
||||
--max-frames 0 \
|
||||
--filter-pointcloud \
|
||||
--use-density-filter \
|
||||
--pointcloud-classifier "/home/ubuntu/projects/FishMeasure/pointcloud_classifier/Pointnet_Pointnet2_pytorch/log/classification/fish_pointnet2_finetune/checkpoints/best_model.pth" \
|
||||
--use-pointcloud-classifier \
|
||||
--pointcloud-classifier-threshold 0.7 \
|
||||
--use-flatness-filter \
|
||||
--flatness-threshold 70.0 \
|
||||
--frame-stride 1 \
|
||||
--weight-top-k 5
|
||||
#--weight-top-by-length
|
||||
done
|
||||
shopt -u nullglob
|
||||
Reference in New Issue
Block a user