image-classifier / abcli /fashion_mnist.sh
kamangir
validating fashion_mnist predict - kamangir/bolt#692
7b0405b
raw
history blame
2.24 kB
#! /usr/bin/env bash
function fashion_mnist() {
abcli_fashion_mnist $@
}
function abcli_fashion_mnist() {
local task=$(abcli_unpack_keyword $1 help)
if [ $task == "help" ] ; then
abcli_help_line "$abcli_cli_name fashion_mnist ingest" \
"ingest fashion_mnist data."
abcli_help_line "$abcli_cli_name fashion_mnist predict object_1 [name_1] [object]" \
"run fashion_mnist saved/object model name_1 predict on object_1."
abcli_help_line "$abcli_cli_name fashion_mnist save [name_1] [object_1] [force]" \
"[force] save fashion_mnist [in object_1] as name_1."
abcli_help_line "$abcli_cli_name fashion_mnist train [validate]" \
"train fashion_mnist [for validation]."
if [ "$(abcli_keyword_is $2 verbose)" == true ] ; then
python3 -m image_classifier.fashion_mnist --help
fi
return
fi
if [ "$task" == "ingest" ] ; then
python3 -m image_classifier.fashion_mnist \
ingest \
--output_path $abcli_object_path \
${@:2}
abcli_tag set . fashion_mnist
return
fi
if [ "$task" == "predict" ] ; then
abcli_huggingface predict \
image-classifier \
$2 \
$(abcli_clarify_arg "$3" fashion-mnist) \
${@:4}
return
fi
if [ "$task" == "save" ] ; then
abcli_huggingface save \
image-classifier \
$(abcli_clarify_arg "$2" fashion-mnist) \
${@:3}
return
fi
if [ "$task" == "train" ] ; then
local model_object=$abcli_object_name
local options=$2
local do_validate=$(abcli_option_get_unpacked "$options" "validate" 0)
abcli_select - ~trail
abcli_fashion_mnist ingest
local data_object=$abcli_object_name
abcli_log "fashion_mnist.train($data_object): $options"
abcli_select $model_object ~trail
abcli_image_classifier_train \
$data_object \
~color,~convnet,validate=$do_validate \
${@:3}
abcli_tag set . fashion_mnist
return
fi
abcli_log_error "-fashion_mnist: $task: command not found."
}