Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run capsnet with New dataset,Can you help me, please? #23

Open
IreneTa opened this issue Jun 16, 2020 · 5 comments
Open

run capsnet with New dataset,Can you help me, please? #23

IreneTa opened this issue Jun 16, 2020 · 5 comments

Comments

@IreneTa
Copy link

IreneTa commented Jun 16, 2020

I ran my dataset on a capsule network. My image size is 224 * 224. I modified caps_ 2_ vec_ Len and upsample3= tf.image.resize_ nearest_ Neighbor (conv2, (224, 224)) and data_ handler, I'm a novice. I don't understand the code very well. Is there anything else in the _build_decoder decoder that needs to be modified?
`fc1 = tf.contrib.layers.fully_connected(capsule_vector, num_outputs=400)
fc1 = tf.reshape(fc1, shape=(batch_size, 5, 5, 16))
upsample1 = tf.image.resize_nearest_neighbor(fc1, (8, 8))
conv1 = tf.layers.conv2d(upsample1, 4, (3,3), padding='same', activation=tf.nn.relu)

    upsample2 = tf.image.resize_nearest_neighbor(conv1, (16, 16))
    conv2 = tf.layers.conv2d(upsample2, 8, (3,3), padding='same', activation=tf.nn.relu)

    upsample3 = tf.image.resize_nearest_neighbor(conv2, (224, 224))
    conv6 = tf.layers.conv2d(upsample3, 16, (3,3), padding='same', activation=tf.nn.relu)

    # 3 channel for RGG
    logits = tf.layers.conv2d(conv6, 3, (3,3), padding='same', activation=None)
    decoded = tf.nn.sigmoid(logits, name='decoded')
    tf.summary.image('reconstruction_img', decoded)

`

@koushikkumarl
Copy link

@IreneTa - I am attempting to solve a similar problem with image size 256*256. Were you able to find the solution with right parameters? If yes, possible to shred some light on how you approached the solution?

@Moord14
Copy link

Moord14 commented Jan 6, 2021

@IreneTa @koushikkumarl
Hey Guys, I too am having some troble trying to run the diffent image sizes. did anyone find a soultion ?

Regards,
David

@koushikkumarl
Copy link

@IreneTa @koushikkumarl
Hey Guys, I too am having some troble trying to run the diffent image sizes. did anyone find a soultion ?

Regards,
David

Hi David,

I couldn't find a solution with TF2.0 CapsNets code. I instead made use of TF1.15 CapsNets code and implemented it on the dataset. I was able to make change to image, to any required pixel size. Please see if the below link can be of any help to you.
https://github.com/koushikkumarl/capsuleNetwork_cancerclassification

I've taken the capsule network source code from https://github.com/XifengGuo/CapsNet-Keras and made required modifications for end to end implementation.

Regards,
Koushik

@Moord14
Copy link

Moord14 commented Jan 7, 2021 via email

@koushikkumarl
Copy link

Hi Koushik, Thanks for the response and great work by the way. Did you have to modify the source code much or was it mainly converting your images to fit the model ? My images are 600 x 600 x 3 Regards, David

On Thu, Jan 7, 2021 at 10:24 AM koushikkumarl @.***> wrote: @IreneTa https://github.com/IreneTa @koushikkumarl https://github.com/koushikkumarl Hey Guys, I too am having some troble trying to run the diffent image sizes. did anyone find a soultion ? Regards, David Hi David, I couldn't find a solution with TF2.0 CapsNets code. I instead made use of TF1.15 CapsNets code and implemented it on the dataset. I was able to make change to image, to any required pixel size. Please see if the below link can be of any help to you. https://github.com/koushikkumarl/capsuleNetwork_cancerclassification I've taken the capsule network source code from https://github.com/XifengGuo/CapsNet-Keras and made required modifications for end to end implementation. Regards, Koushik — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#23 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARI4Y4RBBSOAHXBJVZ3LSOTSYWDUVANCNFSM4N7VTSGA .

Hi David,

I've observed only one place where we can provide the input image size to mode - in method '_build_inputs(self)'
image

The input here is reshaped further and provided as input to the model. Though I traced back and tried to make required changes, I always ended up with errors appearing either in conv_caps_layer or routing methods.

You can also refer to an implementation from Parth, he worked on capsnets on TF 2.0 or above - link: https://medium.com/@parthdedhia/hi-koushik-i-have-tried-implementing-the-capsule-network-for-cifar-10-dataset-with-32x32x3-input-44df862890a1

Hope this helps. 👍 If you have further queries, please feel free to reach me on koushikkumar1102@gmail.com

Regards,
Koushik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants