-
Notifications
You must be signed in to change notification settings - Fork 15
/
openiss-yolo-interactive.sh
executable file
·90 lines (75 loc) · 2.67 KB
/
openiss-yolo-interactive.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
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/encs/bin/tcsh
# Load required modules
module load anaconda3/2023.03/default
module load cuda/9.2/default
# Define environment name and path
set ENV_NAME = "yolo_env"
set ENV_DIR = "/speed-scratch/$USER/envs"
set ENV_PATH = "$ENV_DIR/$ENV_NAME"
set TMP_DIR = "/speed-scratch/$USER/envs/tmp"
set PKGS_DIR = "/speed-scratch/$USER/envs/pkgs"
mkdir -p $ENV_DIR
mkdir -p $TMP_DIR
mkdir -p $PKGS_DIR
setenv TMP $TMP_DIR
setenv TMPDIR $TMP_DIR
setenv CONDA_PKGS_DIRS $PKGS_DIR
# Check if the environment exists
conda env list | grep "$ENV_NAME"
if ($status == 0) then
echo "Environment $ENV_NAME already exists. Activating it..."
echo "======================================================"
conda activate "$ENV_PATH"
if ($status != 0) then
echo "Error: Failed to activate Conda environment."
exit 1
endif
else
echo "Creating Conda environment $ENV_NAME at $ENV_PATH..."
echo "===================================================="
conda create -y -p "$ENV_PATH"
echo "Activating environment $ENV_NAME..."
echo "==================================="
conda activate "$ENV_PATH"
if ($status != 0) then
echo "Error: Failed to activate Conda environment."
exit 1
endif
echo "Installing required packages..."
echo "==============================="
conda install -y -c conda-forge python=3.5.6
conda install -y Keras=2.1.5
conda install -y pillow matplotlib h5py
pip install --upgrade pip
pip install opencv-python==4.1.2.30
pip install opencv-contrib-python==4.1.2.30
endif
echo "Conda environemnt summary..."
echo "============================"
conda info --envs
conda list
# Download YOLOv3 weights
if (! -e yolov3.weights || -z yolov3.weights) then
echo "Downloading YOLOv3 weights..."
echo "============================="
wget https://pjreddie.com/media/files/yolov3.weights
else
echo "YOLOv3 weights already exist. Skipping download..."
echo "=================================================="
endif
sleep 30
# Convert the Darknet YOLO model to a Keras model
if (! -e model_data/yolo.h5 || -z model_data/yolo.h5) then
echo "Keras model NOT found. Converting Darknet YOLO model to Keras format..."
echo "======================================================================="
srun python convert.py yolov3.cfg yolov3.weights model_data/yolo.h5
else
echo "Keras model already exists. Skipping conversion..."
echo "=================================================="
endif
# Run YOLO video processing - video example (interactive)
echo "Running interactive YOLO video processing..."
echo "============================================"
srun python yolo_video.py --input video/v1.avi --output video/002.avi --interactive
conda deactivate
exit