-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathload_raw_image.py
More file actions
32 lines (24 loc) · 1021 Bytes
/
load_raw_image.py
File metadata and controls
32 lines (24 loc) · 1021 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# To run first unzip ../load_raw_image_data.zip into ../
# so the train and test directories reside in this directory
from autokeras import load_image_dataset
from autokeras import ImageClassifier
def load_images():
x_train, y_train = load_image_dataset(csv_file_path="train/label.csv",
images_path="train")
print(x_train.shape)
print(y_train.shape)
x_test, y_test = load_image_dataset(csv_file_path="test/label.csv",
images_path="test")
print(x_test.shape)
print(y_test.shape)
return x_train, y_train, x_test, y_test
def run():
x_train, y_train, x_test, y_test = load_images()
# After loading train and evaluate classifier.
clf = ImageClassifier(verbose=True, augment=False)
clf.fit(x_train, y_train, time_limit=12 * 60 * 60)
clf.final_fit(x_train, y_train, x_test, y_test, retrain=True)
y = clf.evaluate(x_test, y_test)
print(y * 100)
if __name__ == '__main__':
run()