我正在开发一个自动编码器使用张量流。在计算损失函数时,我遇到一个错误,说维数必须相等才能求平均值。所以我显示了输入层和输出层的形状,它们都是不同的,我无法分析问题出在哪里。数据集中使用的图像的形状为(54,96,3)
这是我的密码##--------------------------------------------
import cv2 as cv
import numpy as np
import tensorflow as tf
import argparse
import os
import glob
import matplotlib
import matplotlib.pyplot as plt
from functools import partial
def load_images_from_folder(folder):
images = []
for filename in os.listdir(folder):
img = cv.imread(os.path.join(folder,filename))
if img is not None:
images.append(img)
return np.asarray(images)
def plot_image(image, cmap = "Greys_r"):
plt.imshow(image.reshape([54, 96, 3]).astype(np.uint8),
cmap=cmap,interpolation="nearest")
plt.axis("off")
def _parse