sagieppel / Fully-convolutional-neural-network-FCN-for-semantic-segmentation-Tensorflow-implementation

68 stars 40 forks source link

Cannot run inference.py to predict the test set #4

Open grande89 opened 6 years ago

grande89 commented 6 years ago

Hello, Thanks for sharing the code. I'm a very beginner in coding and deep learning thing. It helps me a lot.

I got a problem. After I trained the model, I tried running inference.py to predict the test set I got the error as below.

runfile('C:/Users/HP/Desktop/FCN/Inference.py', wdir='C:/Users/HP/Desktop/FCN') D:\Users\HP\Anaconda3\lib\site-packages\h5py__init__.py:34: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type. from ._conv import register_converters as _register_converters npy file loaded build model started WARNING:tensorflow:From C:\Users\HP\Desktop\FCN\BuildNetVgg16.py:110: calling argmax (from tensorflow.python.ops.math_ops) with dimension is deprecated and will be removed in a future version. Instructions for updating: Use the axis argument instead FCN model built Setting up Saver... INFO:tensorflow:Restoring parameters from logs/model.ckpt-1000 Model restored... Running Predictions: Saving output to:Output_Prediction/ Start Predicting 22 images 0.0% Traceback (most recent call last):

File "", line 1, in runfile('C:/Users/HP/Desktop/FCN/Inference.py', wdir='C:/Users/HP/Desktop/FCN')

File "D:\Users\HP\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile execfile(filename, namespace)

File "D:\Users\HP\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile exec(compile(f.read(), filename, 'exec'), namespace)

File "C:/Users/HP/Desktop/FCN/Inference.py", line 81, in main()#Run script

File "C:/Users/HP/Desktop/FCN/Inference.py", line 76, in main LabelPred = sess.run(Net.Pred, feed_dict={image: Images, keep_prob: 1.0})

File "D:\Users\HP\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 895, in run run_metadata_ptr)

File "D:\Users\HP\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1097, in _run np_val = np.asarray(subfeed_val, dtype=subfeed_dtype)

File "D:\Users\HP\Anaconda3\lib\site-packages\numpy\core\numeric.py", line 492, in asarray return array(a, dtype, copy=False, order=order)

ValueError: could not broadcast input array from shape (227,227,3) into shape (1,227,227)

Please help. Thank you so much.