forked from PetervanLunteren/EcoAssist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
label.command
executable file
·49 lines (43 loc) · 1.71 KB
/
label.command
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
#!/usr/bin/env bash
### OSX and Linux commands to open Human-in-the-loop from EcoAssist https://github.com/PetervanLunteren/EcoAssist
### Peter van Lunteren, 19 Oct 2023 (latest edit)
# check the OS and set var
if [ "$(uname)" == "Darwin" ]; then
echo "This is an OSX computer..."
if [[ $(sysctl -n machdep.cpu.brand_string) =~ "Apple" ]]; then
echo " ...with an Apple Silicon processor."
PLATFORM="Apple Silicon Mac"
else
echo " ...with an Intel processor."
PLATFORM="Intel Mac"
fi
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
echo "This is an Linux computer."
PLATFORM="Linux"
fi
# set location var
if [ "$PLATFORM" = "Apple Silicon Mac" ] || [ "$PLATFORM" = "Intel Mac" ]; then
LOCATION_ECOASSIST_FILES="/Applications/.EcoAssist_files"
elif [ "$PLATFORM" = "Linux" ]; then
LOCATION_ECOASSIST_FILES="$HOME/.EcoAssist_files"
fi
# set variables
CONDA_DIR="${LOCATION_ECOASSIST_FILES}/miniforge"
ECOASSISTCONDAENV="${CONDA_DIR}/envs/ecoassistcondaenv"
PIP="${ECOASSISTCONDAENV}/bin/pip"
HOMEBREW_DIR="/opt/homebrew"
# add paths
export PYTHONPATH="$PYTHONPATH:$LOCATION_ECOASSIST_FILES"
export PATH="$CONDA_DIR/envs/ecoassistcondaenv/lib/python3.8/site-packages:$PATH"
if [ "$PLATFORM" = "Apple Silicon Mac" ] ; then
export PATH="$HOMEBREW_DIR/bin:$PATH"
fi
# open Human-in-the-loop with arguments given by EcoAssist_GUI.py
cd $LOCATION_ECOASSIST_FILES/Human-in-the-loop || { echo "Could not change directory to Human-in-the-loop. Command could not be run."; exit 1; }
pyrcc5 -o libs/resources.py resources.qrc
echo "python3 labelImg.py '${1}' '${2}'"
if [ "$PLATFORM" = "Apple Silicon Mac" ] ; then
arch -arm64 python3 labelImg.py "${1}" "${2}"
else
python3 labelImg.py "${1}" "${2}"
fi