Coder Social home page Coder Social logo

Comments (7)

AnushaMehta avatar AnushaMehta commented on June 19, 2024 1

@AnushaMehta the problem here is that you are trying to reshape "loaded[16:]" array which has in total 1,20,58,624 values to a tensor of dimension (602,256,256,1) which has 3,94,52,672 values. So as you might have observed by now that this is not possible, you need to reshape into shape of (-1, 256, 256, 1). Here -1 is the dimension value accordingly calculated automatically. Is your doubt clear by now?

@parinaya-007 Thank you so much. It works.

from capsnet-tensorflow.

MitraTj avatar MitraTj commented on June 19, 2024

Hi,
I have another error when I use another dataset. my data is 32x32x3. consists of train.tar.gz and test.tar.gz only. error:
cannot reshape array of size 651786224 into shape(73257,32,32,3)

from capsnet-tensorflow.

parinaya-007 avatar parinaya-007 commented on June 19, 2024

@guddulrk you must first hand simulate the output of conv1 in your case of input to conv1 i.e., 48x48x3. You will see that output of conv1 in your case will be different i.e., it will be [cfg.batch_size, 40, 40, 256] as per the current code of capsnet.py .

from capsnet-tensorflow.

parinaya-007 avatar parinaya-007 commented on June 19, 2024

@SOLOYT You cannot reshape array of size 651786224 into [ _, 32, 32, 3] as 651786224 is not a multiple of 32x32x3. Please look into what you actually have to do or you can elaborate here so that we can discuss it further.

from capsnet-tensorflow.

lawlietyolin avatar lawlietyolin commented on June 19, 2024

Hi,
I have the error like this. My data is 40x40x1. error:
(is_training=True)Assign requires shapes of both tensors to match. lhs shape= [1024,1600] rhs shape= [1024,784]
(is_training=False)Assign requires shapes of both tensors to match. lhs shape= [1,4608,160,8,1] rhs shape= [1,1152,160,8,1]
I have already modified the parameter "height=40" and "width=40" in capsNet.py, line 20.
num_label is 10. No change.

My error maybe occur in this line. I'm not sure:
c_api.TF_GetCode(self.status.status))

from capsnet-tensorflow.

AnushaMehta avatar AnushaMehta commented on June 19, 2024

trainX = loaded[16:].reshape((602, 256, 256, 1)).astype(np.float32)
ValueError: cannot reshape array of size 12058624 into shape (602,256,256,1)

Getting the same error. Can anyone tell me the reason. I have just replace mnist dataset with custom dataset which has 602 grayscale images with 256x256 dimension. Any new suggestions are welcome as I am very new to this programming.
What is the meaning of line ' trainX = loaded[16:].reshape((602, 256, 256, 1)).astype(np.float32)'. I have just replaced numbers according to custom dataset.
Thank you.

from capsnet-tensorflow.

parinaya-007 avatar parinaya-007 commented on June 19, 2024

@AnushaMehta the problem here is that you are trying to reshape "loaded[16:]" array which has in total 1,20,58,624 values to a tensor of dimension (602,256,256,1) which has 3,94,52,672 values. So as you might have observed by now that this is not possible, you need to reshape into shape of (-1, 256, 256, 1). Here -1 is the dimension value accordingly calculated automatically. Is your doubt clear by now?

from capsnet-tensorflow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.