xiaoyeye / CNNC

covolutional neural network based coexpression analysis
MIT License
73 stars 23 forks source link

Running predict_no_y.py with bulk data only #8

Closed rossinerbe closed 4 years ago

rossinerbe commented 4 years ago

Hi, so I have run the example data on my machine with both bulk and single cell data and that works fine. However, when I attempted to run my own data which is only bulk the predict_no_y.py script failed with the error:

Traceback (most recent call last):
  File "predict_no_y.py", line 96, in <module>
    model.load_weights(model_path)
  File "D:\CNNC\venv\lib\site-packages\keras\engine\saving.py", line 492, in load_wrapper
    return load_function(*args, **kwargs)
  File "D:\CNNC\venv\lib\site-packages\keras\engine\network.py", line 1230, in load_weights
    f, self.layers, reshape=reshape)
  File "D:\CNNC\venv\lib\site-packages\keras\engine\saving.py", line 1237, in load_weights_from_hdf5_group
    K.batch_set_value(weight_value_tuples)
  File "D:\CNNC\venv\lib\site-packages\keras\backend\tensorflow_backend.py", line 2960, in batch_set_value
    tf_keras_backend.batch_set_value(tuples)
  File "D:\CNNC\venv\lib\site-packages\tensorflow_core\python\keras\backend.py", line 3323, in batch_set_value
    x.assign(np.asarray(value, dtype=dtype(x)))
  File "D:\CNNC\venv\lib\site-packages\tensorflow_core\python\ops\resource_variable_ops.py", line 819, in assign
    self._shape.assert_is_compatible_with(value_tensor.shape)
  File "D:\CNNC\venv\lib\site-packages\tensorflow_core\python\framework\tensor_shape.py", line 1110, in assert_is_compatible_with
    raise ValueError("Shapes %s and %s are incompatible" % (self, other))
ValueError: Shapes (512, 512) and (1536, 512) are incompatible

As far as I could tell the only difference between my files and the ones from the example was the lack of single cell data. So I tried running the example data without single cell and got the same error. So the dimensions of the NEPDF objects being (N, 32, 32) instead of (N, 64, 32) is clearly the issue, but I cannot figure out how to adjust the predict_no_y.py script. If you could explain it would be greatly appreciated, thanks!

xiaoyeye commented 4 years ago

Hi, The error message indicates that the problem lies in th load model part. I guess it means that the model in the predict_no_y.py has different size to the trained model. Can you check what model you have trained? Was it trained by only 32X32 bulk data or by 64X32 sc+bulk data?

rossinerbe commented 4 years ago

Ah, I see. I am using the KEGG_keras_cnn_trained_model_shallow.h5 provided. So then the issue is that the model was trained with both sc and bulk, and I need to train a model with bulk only? Thanks for your response!

xiaoyeye commented 4 years ago

Yes. I think so. You are welcome. Best  

Ye Yuan, Postdoc

Machine Learning Department

Carnegie Mellon University

Tel:(+1)510213-3332

 

------------------ Original message ------------------ From: "rossinerbe"; Sendtime: Wednesday, May 27, 2020 2:09 AM To: "xiaoyeye/CNNC"; Cc: "502283190"502283190@qq.com; "Comment"; Subject: Re: [xiaoyeye/CNNC] Running predict_no_y.py with bulk data only (#8)

Ah, I see. I am using the KEGG_keras_cnn_trained_model_shallow.h5 provided. So then the issue is that the model was trained with both sc and bulk, and I need to train a model with bulk only? Thanks for your response!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.