Spaces:
Sleeping
Sleeping
File size: 1,225 Bytes
9cf599c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | #!/usr/bin/env bash
set -euo pipefail
# 0) Environment
python3 -V || true
echo "[*] Installing python3-full and python3-venv if needed…"
sudo apt update && sudo apt install -y python3-full python3.12-venv
echo "[*] Creating virtual environment if not exists…"
if [ ! -d ~/anomalib_env ]; then
python3 -m venv ~/anomalib_env
source ~/anomalib_env/bin/activate
pip install -U pip
pip install "anomalib[full]" flask requests cloudinary pillow numpy opencv-python omegaconf torch
else
source ~/anomalib_env/bin/activate
pip install -U pip
pip install "anomalib[full]" flask requests cloudinary pillow numpy opencv-python omegaconf torch
fi
# # 1) Train (PatchCore builds the memory bank from normals)
# anomalib train \
# --config configs/patchcore_transformers.yaml
#
# CKPT=$(ls -1t results/transformers/patchcore/*/weights/*.ckpt | head -n 1)
# echo "[*] Using checkpoint: $CKPT"
#
# # 2) Test/Eval on test/{normal,faulty}
# anomalib test \
# --config configs/patchcore_transformers.yaml \
# --ckpt_path "$CKPT"
echo
echo "[✓] Done. Check:"
echo " • results/transformers/patchcore/**/images/ (heatmaps & overlays)"
echo " • results/transformers/patchcore/**/metrics.csv (AUROC/F1 etc.)"
|