include the Apache license header for process_data.py
diff --git a/examples/largedataset_cnn/process_data.py b/examples/largedataset_cnn/process_data.py
index e25e892..7d92d01 100644
--- a/examples/largedataset_cnn/process_data.py
+++ b/examples/largedataset_cnn/process_data.py
@@ -1,3 +1,22 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
import os
import imghdr
import numpy as np
@@ -10,7 +29,7 @@
for i in range(num_images):
temp = np.array(Image.open(paths[i]).convert('RGB').resize((image_size, image_size), Image.BILINEAR))
temp = np.moveaxis(temp,-1,0)
- im[i] = temp
+ im[i] = temp
im /= 255
@@ -18,7 +37,7 @@
def process_data(dataset_root, classes):
- # load class names
+ # load class names
with open(classes, 'r', encoding='utf-8') as f:
classes = f.readlines()
classes = list(map(lambda x: x.strip(), classes))
@@ -52,16 +71,16 @@
val_labels = labels[border:]
train_input_paths = input_paths[:border]
val_input_paths = input_paths[border:]
-
+
print("Training on %d images and labels" % (len(train_input_paths)))
print("Validation on %d images and labels" % (len(val_input_paths)))
-
+
return train_input_paths, train_labels, val_input_paths, val_labels
def loaddata():
dataset_root = '/Dataset/Data/'
- classes = '/Dataset/classes.txt'
+ classes = '/Dataset/classes.txt'
return process_data(dataset_root, classes)
if __name__ == '__main__':
@@ -72,9 +91,8 @@
print(train_input_paths.shape)
print(train_labels.shape)
print(val_input_paths.shape)
- print(val_labels.shape)
+ print(val_labels.shape)
a=paths_to_images(paths=train_input_paths[0:5], image_size=299)
print(a)
print(a.shape)
-
\ No newline at end of file