def next_batch(self, batch_size=10):
datas = np.empty((0, self._height, self._width, self._dimension), int)
labels = np.empty((0, self._class_len), int)
for idx in range(batch_size):
random.randint(0, len(self._datas)-1)
tmp_img = scipy.misc.imread(self._datas[idx])
tmp_img = scipy.misc.imresize(tmp_img, (self._height, self._width))
tmp_img = tmp_img.reshape(1, self._height, self._width, self._dimension)
datas = np.append(datas, tmp_img, axis=0)
labels = np.append(labels, np.eye(self._class_len)[int(np.asfarray(self._labels[idx]))].reshape(1, self._class_len), axis=0)
return datas, labels
评论列表
文章目录