-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.sh
executable file
·77 lines (61 loc) · 2.19 KB
/
run.sh
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
#!/bin/bash
: <<'END_COMMENT'
1.
1.a. If run in docker:
docker pull [image_id]
1.a.1. If use a GPU:
docker run -it --gpus device=0 -v [repo path]:/codabench [image_id] /bin/bash
1.a.2. If only use CPU:
docker run -it -v [repo path]:/codabench [image_id] /bin/bash
cd codabench
1.b. If run with conda env:
1.b.1. create running env with conda, venv, etc.
conda create --name [name] python=3.10
conda activate [name]
1.b.2. install all necessary dependencies
pip install pillow==10.3.0 tqdm==4.66.4 pandas==2.2.2 scikit-learn==1.4.2
2. edit and run the script
chmod +x run.sh
./run.sh
END_COMMENT
export task_type="folder; predict; evaluate" #folder; predict; evaluate
export data_split="dev"
export baseline_model="bioclip"
export task_folder="${data_split}_${baseline_model}"
## create folder structure
if [[ "$task_type" == *"folder"* ]]; then
mkdir -p sample_result_submission/$task_folder/ref
mkdir -p sample_result_submission/$task_folder/res
export ref_path="/home/wu.5686/imageo/challenge/reference_data/ref_$data_split.csv"
cp $ref_path sample_result_submission/$task_folder/ref
fi
: <<'END_COMMENT'
now, the folder structure for task is as below:
sample_result_submission
- task_folder
-- ref
--- ref.csv
-- res
END_COMMENT
## get the predictions
if [[ "$task_type" == *"predict"* ]]; then
export input_dir="input_data/$data_split"
# export input_dir="/local/scratch/wu.5686/anomaly_challenge/input_data/$data_split"
export output_dir="sample_result_submission/$task_folder/res"
export program_dir="ingestion_program"
if [ "$baseline_model" == "bioclip" ]; then
export submission_dir="baselines/BioCLIP_code_submission"
elif [ "$baseline_model" == "dino" ]; then
export submission_dir="baselines/DINO_SGD_code_submission"
else
echo "$baseline_model is undefined"
exit 1
fi
python3 ingestion_program/ingestion.py $input_dir $output_dir $program_dir $submission_dir
fi
## score the predictions
if [[ "$task_type" == *"evaluate"* ]]; then
export input_dir="sample_result_submission/$task_folder"
export output_dir="sample_result_submission/$task_folder"
python3 scoring_program/score_combined.py $input_dir $output_dir
fi