Train on different dataset
guddulrk opened this issue · 7 comments
Hi,
I want to train the model on character dataset where the images are 48x48x3. When I change the size of the image it shows me an error at this line indicating dimensions must be equal:
assert conv1.get_shape() == [cfg.batch_size, 20, 20, 256]
The total label classes are 68, in my case.
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)
@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 .
@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.
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))
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.
@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?
@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.