kamangir
commited on
Commit
•
08b815a
1
Parent(s):
67dfd4a
validating fashion_mnist train - kamangir/bolt#689
Browse files
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.51"
|
4 |
|
5 |
description = "fashion-mnist + hugging-face + awesome-bash-cli"
|
image_classifier/__main__.py
CHANGED
@@ -129,7 +129,7 @@ elif args.task == "predict":
|
|
129 |
success, test_images = file.load(f"{args.data_path}/test_images.pyndarray")
|
130 |
|
131 |
if success:
|
132 |
-
logger.info(f"test_images: {string.
|
133 |
|
134 |
_, test_labels = file.load(
|
135 |
"{}/test_labels.pyndarray".format(args.data_path),
|
|
|
129 |
success, test_images = file.load(f"{args.data_path}/test_images.pyndarray")
|
130 |
|
131 |
if success:
|
132 |
+
logger.info(f"test_images: {string.pretty_shape_of_matrix(test_images)}")
|
133 |
|
134 |
_, test_labels = file.load(
|
135 |
"{}/test_labels.pyndarray".format(args.data_path),
|
image_classifier/classes.py
CHANGED
@@ -67,8 +67,8 @@ class Image_Classifier(object):
|
|
67 |
def predict(self, test_images, test_labels, output_path="", page_count=-1):
|
68 |
logger.info(
|
69 |
"image_classifier.predict({},{}){}".format(
|
70 |
-
string.
|
71 |
-
string.
|
72 |
"-> {}".format(output_path) if output_path else "",
|
73 |
)
|
74 |
)
|
@@ -332,7 +332,7 @@ class Image_Classifier(object):
|
|
332 |
"train_images,train_labels,test_images,test_labels".split(","),
|
333 |
[train_images, train_labels, test_images, test_labels],
|
334 |
):
|
335 |
-
logger.info("{}: {}".format(name, string.
|
336 |
logger.info(
|
337 |
f"{len(classifier.class_names)} class(es): {', '.join(classifier.class_names)}"
|
338 |
)
|
|
|
67 |
def predict(self, test_images, test_labels, output_path="", page_count=-1):
|
68 |
logger.info(
|
69 |
"image_classifier.predict({},{}){}".format(
|
70 |
+
string.pretty_shape_of_matrix(test_images),
|
71 |
+
string.pretty_shape_of_matrix(test_labels),
|
72 |
"-> {}".format(output_path) if output_path else "",
|
73 |
)
|
74 |
)
|
|
|
332 |
"train_images,train_labels,test_images,test_labels".split(","),
|
333 |
[train_images, train_labels, test_images, test_labels],
|
334 |
):
|
335 |
+
logger.info("{}: {}".format(name, string.pretty_shape_of_matrix(thing)))
|
336 |
logger.info(
|
337 |
f"{len(classifier.class_names)} class(es): {', '.join(classifier.class_names)}"
|
338 |
)
|
image_classifier/fashion_mnist/ingest.py
CHANGED
@@ -31,7 +31,7 @@ def ingest(output_path):
|
|
31 |
[train_images, train_labels, test_images, test_labels],
|
32 |
):
|
33 |
if file.save(os.path.join(output_path, f"{name}.pyndarray"), thing):
|
34 |
-
logger.info(f"ingested {name}: {string.
|
35 |
else:
|
36 |
success = False
|
37 |
|
|
|
31 |
[train_images, train_labels, test_images, test_labels],
|
32 |
):
|
33 |
if file.save(os.path.join(output_path, f"{name}.pyndarray"), thing):
|
34 |
+
logger.info(f"ingested {name}: {string.pretty_shape_of_matrix(thing)}")
|
35 |
else:
|
36 |
success = False
|
37 |
|
image_classifier/funcs.py
CHANGED
@@ -19,7 +19,7 @@ def eval(input_path, output_path):
|
|
19 |
if success:
|
20 |
logger.info(
|
21 |
"groundtruth: {} - {}".format(
|
22 |
-
string.
|
23 |
",".join([str(value) for value in ground_truth[:10]] + ["..."]),
|
24 |
)
|
25 |
)
|
@@ -29,7 +29,7 @@ def eval(input_path, output_path):
|
|
29 |
predictions = np.argmax(predictions, axis=1).astype(np.uint8)
|
30 |
logger.info(
|
31 |
"predictions: {} - {}".format(
|
32 |
-
string.
|
33 |
",".join([str(value) for value in predictions[:10]] + ["..."]),
|
34 |
)
|
35 |
)
|
@@ -129,7 +129,7 @@ def preprocess(
|
|
129 |
error_count += 1
|
130 |
logger.info(
|
131 |
"tensor: {}{}".format(
|
132 |
-
string.
|
133 |
" {} error(s)".format(error_count) if error_count else "",
|
134 |
)
|
135 |
)
|
@@ -164,17 +164,19 @@ def preprocess(
|
|
164 |
)
|
165 |
)
|
166 |
logger.info(
|
167 |
-
"tensor_train: {}".format(string.
|
|
|
|
|
|
|
168 |
)
|
169 |
-
logger.info("tensor_test: {}".format(string.pretty_size_of_matrix(tensor_test)))
|
170 |
logger.info(
|
171 |
"annotations_train: {}".format(
|
172 |
-
string.
|
173 |
)
|
174 |
)
|
175 |
logger.info(
|
176 |
"annotations_test: {}".format(
|
177 |
-
string.
|
178 |
)
|
179 |
)
|
180 |
|
|
|
19 |
if success:
|
20 |
logger.info(
|
21 |
"groundtruth: {} - {}".format(
|
22 |
+
string.pretty_shape_of_matrix(ground_truth),
|
23 |
",".join([str(value) for value in ground_truth[:10]] + ["..."]),
|
24 |
)
|
25 |
)
|
|
|
29 |
predictions = np.argmax(predictions, axis=1).astype(np.uint8)
|
30 |
logger.info(
|
31 |
"predictions: {} - {}".format(
|
32 |
+
string.pretty_shape_of_matrix(predictions),
|
33 |
",".join([str(value) for value in predictions[:10]] + ["..."]),
|
34 |
)
|
35 |
)
|
|
|
129 |
error_count += 1
|
130 |
logger.info(
|
131 |
"tensor: {}{}".format(
|
132 |
+
string.pretty_shape_of_matrix(tensor),
|
133 |
" {} error(s)".format(error_count) if error_count else "",
|
134 |
)
|
135 |
)
|
|
|
164 |
)
|
165 |
)
|
166 |
logger.info(
|
167 |
+
"tensor_train: {}".format(string.pretty_shape_of_matrix(tensor_train))
|
168 |
+
)
|
169 |
+
logger.info(
|
170 |
+
"tensor_test: {}".format(string.pretty_shape_of_matrix(tensor_test))
|
171 |
)
|
|
|
172 |
logger.info(
|
173 |
"annotations_train: {}".format(
|
174 |
+
string.pretty_shape_of_matrix(annotations_train)
|
175 |
)
|
176 |
)
|
177 |
logger.info(
|
178 |
"annotations_test: {}".format(
|
179 |
+
string.pretty_shape_of_matrix(annotations_test)
|
180 |
)
|
181 |
)
|
182 |
|