-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathrun_overnight_colab.sh
More file actions
83 lines (66 loc) · 2.23 KB
/
run_overnight_colab.sh
File metadata and controls
83 lines (66 loc) · 2.23 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
set -e
current_path=$(pwd)
folders=(
'lw-detr'
"rtmdet"
"deim"
"d-fine"
"yolov12"
'rf-detr'
"yolov9"
"rt-detr"
"yolov8"
"yolov10"
"yolov11"
)
for folder in ${folders[@]}; do
cd "$current_path/models/object_detection/$folder"
if [ -f results.json ]; then
mv results.json results.json.old
fi
if [ ! -f results.json ]; then
# Create virtual environment using virtualenv
virtualenv .venv
project_dir="$current_path/models/object_detection/$folder"
# Define full paths
venv_dir="$project_dir/.venv"
VENV_PY="$venv_dir/bin/python"
VENV_PIP="$venv_dir/bin/pip"
VENV_MIM="$venv_dir/bin/mim"
# Upgrade pip
$VENV_PY -m pip install --upgrade pip
# Install dependencies
$VENV_PIP install -r requirements.txt
# Override supervision version
$VENV_PIP install --force-reinstall --no-deps "git+https://github.com/rafaelpadilla/supervision.git@fix/mAP"
if [[ $folder == yolov12* ]]; then
$VENV_PIP install --force-reinstall ultralytics==8.3.151
fi
export MPLBACKEND=Agg
if [[ $folder == rtmdet* ]]; then
$VENV_PIP install -U openmim
$VENV_PY -m mim install mmcv==2.0.0
fi
if [[ $folder == rf-detr* ]]; then
$VENV_PIP uninstall -y onnxruntime onnxruntime-gpu
$VENV_PIP install onnxruntime-gpu
fi
if [[ $folder == lw-detr* ]]; then
if [ ! -d "LW-DETR" ] ; then
git clone https://github.com/Atten4Vis/LW-DETR.git
fi
cd LW-DETR/models/ops
$VENV_PIP install torch==2.5.0+cu124 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124
$VENV_PIP install -U git+https://github.com/qubvel/transformers@fix-custom-kernels
$VENV_PY setup.py build install
cd ../../..
fi
# Run script
$VENV_PY run.py
# Copy only .json files to Drive
find "$current_path/models/object_detection/$folder" -name "*.json" -exec cp --parents {} /content/drive/MyDrive/ \;
else
echo "results.json already exists in $folder"
fi
done