Files
FishServer/FishMeasure/run_predict_from_svo2_fish9.sh

55 lines
1.8 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
# Single case: fish9 only (same flags as run_predict_from_svo2.sh).
# Layout: output_weight_estimator/fish9/<svo_stem>/{cloud,images,weight_prediction.json,...}
#
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"
2026-04-14 22:05:52 +08:00
FISH_NAME="fish1"
fish_dir="${SESSION_ROOT}/${FISH_NAME}/"
OUT_PARENT="output_weight_estimator"
save_out="${OUT_PARENT}/${FISH_NAME}"
if [[ ! -d "$fish_dir" ]]; then
echo "ERROR: not a directory: $fish_dir" >&2
exit 1
fi
shopt -s nullglob
svos=("${fish_dir}"*.svo2)
shopt -u nullglob
if [[ ${#svos[@]} -eq 0 ]]; then
echo "ERROR: no .svo2 in $fish_dir" >&2
exit 1
fi
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.8 \
--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 55.0 \
--frame-stride 1 \
--weight-top-k 5 \
--weight-top-by-length
# Optional: append --no-weight-top-by-length if you want top-K by predicted weight only.