kamangir
commited on
Commit
•
8c7151e
1
Parent(s):
21ce60a
validating single image predict for fashion_mnist - kamangir/bolt#692
Browse files- abcli/image_classifier.sh +14 -9
- image_classifier/__init__.py +1 -1
- image_classifier/__main__.py +4 -4
abcli/image_classifier.sh
CHANGED
@@ -8,8 +8,8 @@ function abcli_image_classifier() {
|
|
8 |
local task=$(abcli_unpack_keyword "$1" help)
|
9 |
|
10 |
if [ "$task" == "help" ] ; then
|
11 |
-
abcli_help_line "$abcli_cli_name image_classifier
|
12 |
-
"
|
13 |
abcli_help_line "$abcli_cli_name image_classifier install" \
|
14 |
"install image_classifier."
|
15 |
abcli_help_line "$abcli_cli_name image_classifier predict data_1 [name_1] [data=filename/*object/url,model=object/*saved]" \
|
@@ -30,9 +30,19 @@ function abcli_image_classifier() {
|
|
30 |
return
|
31 |
fi
|
32 |
|
33 |
-
if [ "$task" == "
|
|
|
|
|
|
|
|
|
|
|
34 |
local model_name=$2
|
35 |
|
|
|
|
|
|
|
|
|
|
|
36 |
local options=$3
|
37 |
local model_source=$(abcli_option "$options" "model" saved)
|
38 |
|
@@ -44,18 +54,13 @@ function abcli_image_classifier() {
|
|
44 |
fi
|
45 |
|
46 |
python3 -m image_classifier \
|
47 |
-
|
48 |
--model_path $model_path \
|
49 |
${@:4}
|
50 |
|
51 |
return
|
52 |
fi
|
53 |
|
54 |
-
if [ "$task" == "install" ] ; then
|
55 |
-
conda install -y -c anaconda seaborn
|
56 |
-
return
|
57 |
-
fi
|
58 |
-
|
59 |
if [ "$task" == "save" ] ; then
|
60 |
abcli_huggingface save \
|
61 |
image-classifier \
|
|
|
8 |
local task=$(abcli_unpack_keyword "$1" help)
|
9 |
|
10 |
if [ "$task" == "help" ] ; then
|
11 |
+
abcli_help_line "$abcli_cli_name image_classifier list [object_1] [model=object/*saved]" \
|
12 |
+
"list saved/object model object_1."
|
13 |
abcli_help_line "$abcli_cli_name image_classifier install" \
|
14 |
"install image_classifier."
|
15 |
abcli_help_line "$abcli_cli_name image_classifier predict data_1 [name_1] [data=filename/*object/url,model=object/*saved]" \
|
|
|
30 |
return
|
31 |
fi
|
32 |
|
33 |
+
if [ "$task" == "install" ] ; then
|
34 |
+
conda install -y -c anaconda seaborn
|
35 |
+
return
|
36 |
+
fi
|
37 |
+
|
38 |
+
if [ "$task" == "list" ] ; then
|
39 |
local model_name=$2
|
40 |
|
41 |
+
if [ -z "$model_name" ] ; then
|
42 |
+
ls $abcli_path_git/image-classifier/saved_model
|
43 |
+
return
|
44 |
+
fi
|
45 |
+
|
46 |
local options=$3
|
47 |
local model_source=$(abcli_option "$options" "model" saved)
|
48 |
|
|
|
54 |
fi
|
55 |
|
56 |
python3 -m image_classifier \
|
57 |
+
list \
|
58 |
--model_path $model_path \
|
59 |
${@:4}
|
60 |
|
61 |
return
|
62 |
fi
|
63 |
|
|
|
|
|
|
|
|
|
|
|
64 |
if [ "$task" == "save" ] ; then
|
65 |
abcli_huggingface save \
|
66 |
image-classifier \
|
image_classifier/__init__.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
name = "image_classifier"
|
2 |
|
3 |
-
version = "1.1.
|
4 |
|
5 |
description = "fashion-mnist + hugging-face + awesome-bash-cli"
|
|
|
1 |
name = "image_classifier"
|
2 |
|
3 |
+
version = "1.1.177"
|
4 |
|
5 |
description = "fashion-mnist + hugging-face + awesome-bash-cli"
|
image_classifier/__main__.py
CHANGED
@@ -15,7 +15,7 @@ parser.add_argument(
|
|
15 |
"task",
|
16 |
type=str,
|
17 |
default="",
|
18 |
-
help="
|
19 |
)
|
20 |
parser.add_argument(
|
21 |
"--objects",
|
@@ -91,11 +91,11 @@ parser.add_argument(
|
|
91 |
args = parser.parse_args()
|
92 |
|
93 |
success = False
|
94 |
-
if args.task == "
|
|
|
|
|
95 |
Image_Classifier().load(args.model_path)
|
96 |
success = True
|
97 |
-
elif args.task == "eval":
|
98 |
-
success = eval(args.input_path, args.output_path)
|
99 |
elif args.task == "predict":
|
100 |
classifier = Image_Classifier()
|
101 |
|
|
|
15 |
"task",
|
16 |
type=str,
|
17 |
default="",
|
18 |
+
help="eval,ingest,list,predict,predict_image,preprocess,train",
|
19 |
)
|
20 |
parser.add_argument(
|
21 |
"--objects",
|
|
|
91 |
args = parser.parse_args()
|
92 |
|
93 |
success = False
|
94 |
+
if args.task == "eval":
|
95 |
+
success = eval(args.input_path, args.output_path)
|
96 |
+
elif args.task == "list":
|
97 |
Image_Classifier().load(args.model_path)
|
98 |
success = True
|
|
|
|
|
99 |
elif args.task == "predict":
|
100 |
classifier = Image_Classifier()
|
101 |
|