Giter VIP home page Giter VIP logo

nikhilroxtomar / deep-residual-unet Goto Github PK

View Code? Open in Web Editor NEW
212.0 6.0 54.0 18.07 MB

ResUNet, a semantic segmentation model inspired by the deep residual learning and UNet. An architecture that take advantages from both(Residual and UNet) models.

Home Page: https://idiotdeveloper.com/what-is-resunet/

Jupyter Notebook 100.00%
resunet semantic-segmentation tensorflow keras-tensorflow fcn

deep-residual-unet's Introduction

Deep-Residual-Unet

ResUNet, a semantic segmentation model inspired by the deep residual learning and UNet. An architecture that take advantages from both(Residual and UNet) models.

Paper: https://arxiv.org/pdf/1711.10684.pdf
Video Explaination: https://youtu.be/BOoBWRTpaKk

Architecture

Deep Residual U-Net Architecture
Deep Residual U-Net Architecture

deep-residual-unet's People

Contributors

nikhilroxtomar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

deep-residual-unet's Issues

Dice Loss TypeError

I am getting TypeError when I run the dice_coef_loss in model.fit:

TypeError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_15776/2786157346.py in
----> 1 results = model.fit(X_train, Y_train, validation_split=0.1, batch_size=4, callbacks = model_checkpoint_callback, epochs=100)

C:\ProgramData\Anaconda3\envs\env1\lib\site-packages\keras\utils\traceback_utils.py in error_handler(*args, **kwargs)
65 except Exception as e: # pylint: disable=broad-except
66 filtered_tb = _process_traceback_frames(e.traceback)
---> 67 raise e.with_traceback(filtered_tb) from None
68 finally:
69 del filtered_tb

C:\ProgramData\Anaconda3\envs\env1\lib\site-packages\tensorflow\python\framework\func_graph.py in autograph_handler(*args, **kwargs)
1145 except Exception as e: # pylint:disable=broad-except
1146 if hasattr(e, "ag_error_metadata"):
-> 1147 raise e.ag_error_metadata.to_exception(e)
1148 else:
1149 raise

TypeError: in user code:

File "C:\ProgramData\Anaconda3\envs\env1\lib\site-packages\keras\engine\training.py", line 1021, in train_function  *
    return step_function(self, iterator)
File "C:\../ipykernel_15776/709000421.py", line 11, in dice_coef_loss  *
    return float(1.0 - dice_coef(y_true, y_pred))
File "C:\..\Local\Temp/ipykernel_15776/2098934712.py", line 6, in dice_coef  *
    intersection = tf.reduce_sum(y_true_f * y_pred_f)

TypeError: Value passed to parameter 'x' has DataType bool not in list of allowed values: b

ResUNet improvement

Thank you for the implementation and explanation of ResUNet! That's really interesting.

It seems to me that you should have a different "bridge" for ResUNet. According to the article, the "bridge" is the same as the "residual block" of ResUNet.
The "bridge" and "residual block" are the same, except that dashed arrow from the entrance of "residual block" to the "Addition" block. But I think this is an error in the article :-) There must be a dashed arrow otherwise we don't need "Addition" block in the "bridge".
So I've changed your code to this:

def ResUNet():
f = [16, 32, 64, 128, 256]
inputs = keras.layers.Input((image_size, image_size, 3))

## Encoder
e0 = inputs
e1 = stem(e0, f[0])
e2 = residual_block(e1, f[1], strides=2)
e3 = residual_block(e2, f[2], strides=2)
e4 = residual_block(e3, f[3], strides=2)

## Bridge
b0 = residual_block(e4, f[4], strides=2)

## Decoder
u1 = upsample_concat_block(b0, e4)
d1 = residual_block(u1, f[4])

u2 = upsample_concat_block(d1, e3)
d2 = residual_block(u2, f[3])

u3 = upsample_concat_block(d2, e2)
d3 = residual_block(u3, f[2])

u4 = upsample_concat_block(d3, e1)
d4 = residual_block(u4, f[1])

outputs = keras.layers.Conv2D(1, (1, 1), padding="same", activation="sigmoid")(d4)
model = keras.models.Model(inputs, outputs)
return model

As you can see I just put "e5" to the "bridge" and that's all :-)
Also I've set 120 epochs and obtained dice coefficient equal to 0.9825
237/237 [==============================] - 11s 48ms/step - loss: 0.0175 - dice_coef: 0.9825 - val_loss: 0.1533 - val_dice_coef: 0.8467

The result is on 8.6% higher than the 1st place on Kaggle, team name "b.e.s. & phalanx". It means that YOU can be a Kaggle winner next time.
Keep doing don't stop :-)

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.