thibo73800 / capsnet-traffic-sign-classifier

A Tensorflow implementation of CapsNet(Capsules Net) apply on german traffic sign dataset
Apache License 2.0
177 stars 90 forks source link

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

Open IreneTa opened 4 years ago

IreneTa commented 4 years ago

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 commented 4 years ago

@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 commented 3 years ago

@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 commented 3 years ago

@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 commented 3 years ago

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 notifications@github.com 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 https://github.com/thibo73800/capsnet-traffic-sign-classifier/issues/23#issuecomment-756027209, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARI4Y4RBBSOAHXBJVZ3LSOTSYWDUVANCNFSM4N7VTSGA .

koushikkumarl commented 3 years ago

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