title: ValueError: Cannot feed value of shape (40, 244, 244) for Tensor 'Placeholder_4:0', which has shape '(40, 224, 224, 3)'
body: <p>I am new to TensorFlow and machine learning. I'm trying to extract features of images. I extracted the features of 1 image successfully but I can't extract images[]
  Here's the script:</p>
  
  <pre><code>#read image
  def readfile(pathdir):
  paths = glob.glob(pathdir + "*.png")
  img_data_list=[]
  imgs = [cv2.imread(file,cv2.IMREAD_COLOR) for file in paths]
  
  
  for img in imgs:
         img=cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
         img_resize=cv2.resize(img,(244,244),3)
  
         img_data_list.append(img_resize)
  
  img_data = np.array(img_data_list)
  np.expand_dims(img_data, axis=0)
  #img_data = array(img_data).reshape(1, 244,244,3)
  names = [os.path.basename(path) for path in paths]
  with open(pathdir + "value.txt") as file:
      nvl= file.readlines()
  nvl = {line.split()[0]:float(re.sub(r'\n', "", line.split()[1])) for line 
  in nvl}
  value =[]
  for i in names:
    value.append(nvl[i])
  return img_data, np.array(value), names
  # extract features
  def feature(train_imgs):
  with tf.Session(config=tf.ConfigProto(gpu_options= 
  (tf.GPUOptions(per_process_gpu_memory_fraction=0.7)))) as sess:
  #with tf.device('/cpu:0'):
    #with tf.Session() as sess:
        images = tf.placeholder("float", [np.shape(train_imgs)[0], 224, 
  224, 3])
       [bunch of code]
        return features
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>ValueError                                Traceback (most recent call 
  last)
   &lt;ipython-input-23-b21a5d063db6&gt; in feature(train_imgs)
   47               vgg.build(images)
   48           print("Extracting feature...")
   ---&gt; 49           features = sess.run(vgg.fc6, feed_dict=feed_dict)
   50           print('FC6 feature: ', features)
   51           print('Number of input: ', len(features))
  
   /usr/local/lib/python3.6/dist- 
   packages/tensorflow/python/client/session.py in run(self, fetches, 
  feed_dict, options, run_metadata)
  927     try:
  928       result = self._run(None, fetches, feed_dict, options_ptr,
  --&gt; 929                          run_metadata_ptr)
  930       if run_metadata:
  931         proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)
  
  /usr/local/lib/python3.6/dist- 
  packages/tensorflow/python/client/session.py in _run(self, handle, 
  fetches, feed_dict, options, run_metadata)
  1126                              'which has shape %r' %
  1127                              (np_val.shape, subfeed_t.name,
  -&gt; 1128                               str(subfeed_t.get_shape())))
  1129           if not self.graph.is_feedable(subfeed_t):
  1130             raise ValueError('Tensor %s may not be fed.' % 
  subfeed_t)
  
  ValueError: Cannot feed value of shape (40, 244, 244) for Tensor  
  Placeholder_4:0', which has shape '(40, 224, 224, 3)' 
  </code></pre>
  
  <p>What's Wrong and how to fix this problem.
  Thank in advance!! </p>