Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Car Tweaks #66

Merged
merged 3 commits into from
Nov 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions website/public/car_activation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,36 @@ CAR_TWEAKS()
cp ${templatesPath}/login.html ${backupDir}/login.html.bak
rm ${templatesPath}/login.html
mv login.html ${templatesPath}/login.html

# Enable use of model optimizer cache
echo -e -n "\n- Enable model optimizer cache"
patch -p3 -d ${modelOptimizerPath} << 'EOF'
diff --git a/model_optimizer_pkg/model_optimizer_pkg/model_optimizer_node.py b/model_optimizer_pkg/model_optimizer_pkg/model_optimizer_node.py
index 1b6c315..6db49ac 100644
--- a/model_optimizer_pkg/model_optimizer_pkg/model_optimizer_node.py
+++ b/model_optimizer_pkg/model_optimizer_pkg/model_optimizer_node.py
@@ -240,6 +240,15 @@ class ModelOptimizerNode(Node):
"""
if not os.path.isfile(common_params[constants.MOKeys.MODEL_PATH]):
raise Exception(f"Model file {common_params[constants.MOKeys.MODEL_PATH]} not found")
+
+ # Check if model exists
+ if os.path.isfile(os.path.join(common_params[constants.MOKeys.OUT_DIR],
+ f"{common_params[constants.MOKeys.MODEL_NAME]}.bin")):
+ self.get_logger().info(f"Cached model: {common_params[constants.MOKeys.MODEL_NAME]}.xml")
+ return 0, os.path.join(common_params[constants.MOKeys.OUT_DIR],
+ f"{common_params[constants.MOKeys.MODEL_NAME]}.xml")
+
+
cmd = f"{constants.PYTHON_BIN} {constants.INTEL_PATH}{mo_path}"
# Construct the cli command
for flag, value in dict(common_params, **platform_parms).items():
EOF

# Prevent double click on the range buttons to zoom in
echo -e -n "\n- Fix range button zoom issue"
cp ${staticPath}/bundle.css ${backupDir}/bundle.css.bak
sed -i 's/.range-btn-minus button,.range-btn-plus button{background-color:#aab7b8!important;border-radius:4px!important;border:1px solid #879596!important}/.range-btn-minus button,.range-btn-plus button{background-color:#aab7b8!important;border-radius:4px!important;border:1px solid #879596!important;touch-action: manipulation;user-select: none;}/' ${staticPath}/bundle.css
}

# Check the operating system version and architecture
Expand Down Expand Up @@ -353,7 +383,9 @@ elif [ $DISTRIB_RELEASE = "20.04" ] || [ $DISTRIB_RELEASE = "22.04" ]; then
bundlePath=/opt/aws/deepracer/lib/device_console/static
systemPath=/opt/aws/deepracer/lib/deepracer_systems_pkg/lib/${pythonPath}/site-packages/deepracer_systems_pkg
templatesPath=/opt/aws/deepracer/lib/device_console/templates
staticPath=/opt/aws/deepracer/lib/device_console/static
webserverPath=/opt/aws/deepracer/lib/webserver_pkg/lib/${pythonPath}/site-packages/webserver_pkg
modelOptimizerPath=/opt/aws/deepracer/lib/model_optimizer_pkg/lib/${pythonPath}/site-packages/model_optimizer_pkg

# Create backup directory
homeDir=$(eval echo ~${SUDO_USER})
Expand Down