sketch_data_handler.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:gy_mlcamp17 作者: gylee1103 项目源码 文件源码
def _enqueue_op(self, queue, msg_queue):
      while msg_queue.qsize() == 0:
        # randomly select index
        indexes = np.random.randint(0, self._total_num, self.batch_size)
        sz = self.target_size
        output = np.zeros([self.batch_size, sz, sz, 1])
        for i in range(len(indexes)):
          index = indexes[i]
          output[i] = self._random_preprocessing(scipy.misc.imread(
            self._image_paths[index], mode='L').astype(np.float),
            self.target_size).reshape([sz, sz, 1])
          while np.amin(output[i]) == np.amax(output[i]): # some data are strange..
            output[i] = self._random_preprocessing(scipy.misc.imread(
              self._image_paths[index], mode='L').astype(np.float32),
              self.target_size).reshape([sz, sz, 1])

        queue.put(output)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号