Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: work on new install script for docker
- Loading branch information
Showing
6 changed files
with
119 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
.next/ | ||
node_modules/ | ||
*.ffm | ||
*.bak | ||
prototype/video | ||
history.db | ||
static/trackerHistory.json | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
TODO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
#!/bin/bash | ||
|
||
# exit when any command fails | ||
set -e | ||
|
||
VERSION=v2 | ||
# # PLATFORM in ["nano","xavier","tx2","dockernvidia"] | ||
PLATFORM=undefined | ||
|
||
DEFAUT_VIDEO_INPUT_nano=raspberrycam | ||
DEFAUT_VIDEO_INPUT_tx2=usbcam | ||
DEFAUT_VIDEO_INPUT_xavier=usbcam | ||
|
||
DEFAUT_NEURAL_NETWORK_nano=yolov3-tiny | ||
DEFAUT_NEURAL_NETWORK_tx2=yolov2-voc | ||
DEFAUT_NEURAL_NETWORK_xavier=yolov3 | ||
|
||
|
||
# animals_moo=cow; sound=moo; i="animals_$sound"; echo "${!i}" | ||
|
||
echo "Installing opendatacam docker image" | ||
|
||
display_usage() { | ||
echo | ||
echo "Usage: $0" | ||
|
||
echo " -p, --platform Specify platform : nano, xavier, tx2" | ||
echo " -h, --help Display usage instructions" | ||
echo | ||
} | ||
|
||
raise_error() { | ||
local error_message="$@" | ||
echo "${error_message}" 1>&2; | ||
} | ||
|
||
argument="$1" | ||
|
||
if [[ -z $argument ]] ; then | ||
raise_error "Expected argument to be present" | ||
display_usage | ||
else | ||
case $argument in | ||
-h|--help) | ||
display_usage | ||
;; | ||
-p|--platform) | ||
# TODO Check if existing docker image is running and stop it if it is the case | ||
|
||
# Platform is specified | ||
PLATFORM=$2 | ||
# TODO verify if PLATFORM is oneOf(nano, xavier, tx2) | ||
echo "Installing opendatacam $VERSION for platform: $2" | ||
# Get the run-docker script | ||
wget -N https://raw.githubusercontent.com/moovel/lab-opendatacam/$VERSION/docker/run-jetson/run-docker.sh | ||
|
||
# Chmod to give exec permissions | ||
chmod 777 run-docker.sh | ||
|
||
# Get the config file | ||
wget -N https://raw.githubusercontent.com/moovel/lab-opendatacam/$VERSION/config.json | ||
|
||
# Replace VIDEO_INPUT and NEURAL_NETWORK with default config for this platform | ||
sed -i'.bak' -e 's/TO_FILL_VIDEO_INPUT/$DEFAUT_VIDEO_INPUT_$PLATFORM/g' config.json | ||
# sed -i'.bak' -e 's/TO_FILL_NEURAL_NETWORK/yolov3/g' config.json | ||
|
||
# Pull, install and run opendatacam container when docker starts (on boot with --restart unless-stopped, -d is for detached mode) | ||
# sudo ./darknet-docker.sh run -d --restart unless-stopped tdurand/opendatacam:v2.0.0-beta.1-nano | ||
|
||
# Message that docker container has been started and opendatacam will be available shorty on <IP> | ||
echo "Opendatacam docker container started successfully, it might take up to 1 min to start the node app" | ||
echo "Open browser at http://<IP_OF_JETSON>:8080 or http://localhost:8080" | ||
echo "Opendatacam will start automaticaly on boot when you restart you jetson" | ||
echo "If you want to stop it or update it blabalbalabl" | ||
|
||
;; | ||
*) | ||
raise_error "Unknown argument: ${argument}" | ||
display_usage | ||
;; | ||
esac | ||
fi | ||
|
||
echo "Finished script $0" | ||
|
||
|
||
# "SETTINGS_BY_PLATFORM": { | ||
# "nano": { | ||
# "VIDEO_INPUT": "raspberrycam", | ||
# "NEURAL_NETWORK": "yolov3-tiny" | ||
# }, | ||
# "tx2": { | ||
# "VIDEO_INPUT": "usbcam", | ||
# "NEURAL_NETWORK": "yolov2-voc" | ||
# }, | ||
# "xavier": { | ||
# "VIDEO_INPUT": "usbcam", | ||
# "NEURAL_NETWORK": "yolov3" | ||
# } | ||
# }, | ||
|
||
|
||
|
6 changes: 4 additions & 2 deletions
6
docker/run-jetson/darknet-docker.sh → docker/run-jetson/run-docker.sh
100644 → 100755
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters