利用python将二进制图片转化成图片并展示
mnist数据集的数据以二进制格式存储,下面读取mnist数据集的指定图片并展示
import torch.optim
from network import Mnist_network
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
mnist_network = Mnist_network()
mnist_network = mnist_network.load_state_dict(torch.load('models/mnist_network.pt'))
def load_mnist(mnist_images_file, mnist_labels_file, order):
with open(mnist_images_file, 'rb') as f1:
img_file =
共有 0 条评论