Skip to content

Commit

Permalink
updating
Browse files Browse the repository at this point in the history
  • Loading branch information
abhimanyudubey committed Aug 23, 2016
1 parent a9834cb commit f988869
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions code/data_preprocess_calculate_mean.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import os,sys
import numpy as np
import caffe
import glob

if __name__=="__main__":

if len(sys.argv) < 3:
print "Usage python data_preprocess_calculate_mean.py <input-folder> <output-mean-file> <optional-resize-value>"
else:
# calculating the mean and writing it to a file
dir_src = sys.argv[1]
file_output = sys.argv[2]
image_size = 256
if len(sys.argv) > 3:
image_size = int(sys.argv[3])
list_image_files = glob.glob(os.path.join(dir_src, "*.JPG"))+glob.glob(os.path.join(dir_src, "*.jpg"))
for input_image in list_image_files:
mat_input_image = caffe.io.load_image(input_image, color=True)

0 comments on commit f988869

Please sign in to comment.