Update ML setup guide and add model scripts
This commit is contained in:
parent
073d395ae6
commit
ff1561a704
4 changed files with 121 additions and 3 deletions
32
convert_model.sh
Executable file
32
convert_model.sh
Executable file
|
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Check if tensorflowjs is installed
|
||||
if ! command -v tensorflowjs_converter &> /dev/null
|
||||
then
|
||||
echo "tensorflowjs_converter could not be found. Please install it using: pip install tensorflowjs"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
MODEL_TYPE=$1
|
||||
INPUT_MODEL=$2
|
||||
OUTPUT_DIR=$3
|
||||
|
||||
if [ -z "$MODEL_TYPE" ] || [ -z "$INPUT_MODEL" ] || [ -z "$OUTPUT_DIR" ]; then
|
||||
echo "Usage: ./convert_model.sh [suit|value] [path_to_h5_model] [output_directory]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Converting $MODEL_TYPE model from $INPUT_MODEL to $OUTPUT_DIR..."
|
||||
|
||||
# Create output directory if it doesn't exist
|
||||
mkdir -p "$OUTPUT_DIR"
|
||||
|
||||
# Perform conversion
|
||||
tensorflowjs_converter --input_format=keras "$INPUT_MODEL" "$OUTPUT_DIR"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Conversion successful. Model saved to $OUTPUT_DIR"
|
||||
else
|
||||
echo "Conversion failed."
|
||||
exit 1
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue