0

I have memmap array contains images like this where each image is an array of size (1,784) :

np.memmap('/home/usr/ds', dtype='float32', mode='r', shape=(1300, 784))

I want to know how can I do Image mean subtraction to normalize all images.

ga97rasl
  • 307
  • 2
  • 7
  • 15
  • If you have OpenCV you can try `cv2.mean(image)` – Jeru Luke Jan 29 '17 at 05:38
  • I can't use OpenCV and normalize each image one by one. I wanted to normalize whole dataset in each eopch of training and test on the fly. Right now I'm using mean_ds=np.mean(train_labeled) std_ds = np.std(train_labeled) train_labeled = (train_labeled - mean_ds) / std_ds but it's not working! – ga97rasl Jan 29 '17 at 11:59
  • **First** run `np.mean()` and `np.std()` for the entire dataset. **After that** perform *mean subtraction* for the dataset using the *mean* and *standard deviation* values. – Jeru Luke Jan 29 '17 at 12:04

0 Answers0