lindawangg / COVID-Net

COVID-Net Open Source Initiative
Other
1.15k stars 480 forks source link

DataLossError While Loading Model #29

Closed miracatici closed 4 years ago

miracatici commented 4 years ago

Issue

DataLossError While Loading Model

Environment

Description

Hi, while I'm trying to load model for inference or evaluation in jupyter, I always got this error.

DataLossError: Checksum does not match: stored 1497157360 vs. calculated on the restored bytes 2410561084
     [[node save/RestoreV2 (defined at /usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/ops.py:1748) ]]

My full notebook is shown below

import numpy as np
import os, argparse
import cv2
import tensorflow as tf
weightspath = '/tf/notebooks/mrc_is_here/COVID-Net/models/covid-net-large'
metaname = "model.meta_eval"
ckptname = "model-2069"
imagepath = 'assets/ex-covid.jpeg'

mapping = {'normal': 0, 'pneumonia': 1, 'COVID-19': 2}
inv_mapping = {0: 'normal', 1: 'pneumonia', 2: 'COVID-19'}
sess = tf.Session()
tf.get_default_graph()
saver = tf.train.import_meta_graph(os.path.join(weightspath, metaname))
saver.restore(sess, os.path.join(weightspath, ckptname))

My folder structure is:

COVID-NET

Steps to Reproduce

  1. Create a model folder as shown above
  2. Copy all the code to a new jupyter notebook
  3. Run step by step

Expected behavior

Restore model from meta and checkpoint files

Actual behavior

Throw exception DataLossError

lindawangg commented 4 years ago

This usually means that one of the model files got corrupted when downloading. Try downloading again. You can also try to use model.meta_train.