Giter Club home page Giter Club logo

keras_application_3d's Introduction

keras-applications-3D

'keras-applications-3D' is 3D-image deep learning models based on popular 2D models. (Based on the Keras)


Install

pip install Keras-Applications-3D

Usage

### Prepare your 3D data [Ex. (64,64,64,1) shape]
# ...
X = np.zeros((128, 64, 64, 64, 1))
y = np.zeros((128, 10))
y[:,0] = 1
# ...

### Oriinal channel of model is '64->128->256->...'
### But it takes a lot of memory, So we reduce first channel 64 to 16
model = vgg19.VGG19(
  input_shape=(64,64,64,1), classes=10,
  base_channel=16
)
# model.summary()

### Training
model.compile(
    loss='categorical_crossentropy', 
    optimizer=Adam(learning_rate=1e-4),
    metrics=['acc']
)

history = model.fit(
    x=X, y=y, 
)

### Inference
pred = model.predict(X).squeeze()
real = y

pred = pred.argmax(axis=1)
real = real.argmax(axis=1)

accr = (pred == real).sum() / len(real)
print('Accuracy: {:04f}'.format(accr))

This repository provide below things

  • Major 2D CNN architecture for 3D ([V]: Complete, []: In progress)
    • VGG (16, 19)
    • ResNet (50, 101, 152)
    • ResNetV2 (50, 101, 152)
    • DenseNet (121, 169, 201)
    • ResNext
    • InceptionV3
    • Inception_Resnet_V2
    • Xception
    • EfficientNet (B0, B1, ..., B7)
    • Mobilenet (V1, V2)
    • SE-ResNet
    • NFNet
  • Convolution function for 3D (keras_applications_3d/custom_layers.py)
    • DepthwiseConv3D
    • SeparableConv3D
  • Documentation
    • Documentation
  • Exmaple
    • Classification
    • Regression
    • Visualize trained model
  • Visualization
    • Saliency map (Simple gradient)
    • Class Activation Map (GradCAM)
    • Activation Maximization
  • Pretrained weight
    • ModelNet10
    • ModelNet40
    • (Please recommand any 3D dataset)

Model benchmark

Model ModelNet10 accuracy Number of parameters
VGG16 (16) 0.9001 23,780,058
VGG19 (16) 0.9075 24,775,706
ResNet50 (16) 0.8062 2,923,818
ResNet101 (16) 0.7467 5,393,578
ResNet152 (16) 0.7588 7,429,418
ResNet50V2 (16) 0.8194 2,918,090
ResNet101V2 (16) 0.8128 5,385,674
ResNet152V2 (16) 0.8007 7,419,594
DenseNet121 (16) 0.9042 2,884,010
DenseNet169 (16) 0.8855 4,768,298
DenseNet201 (16) 0.8998 6,519,594

Example


FYI

If you want to use 3D CNN, you'd better reduce number of parameter because of curse of dimension.

  • So We prepare some custom model to handle this.
  • Please check base_channel or growth_rate option.

When you use 3D CNN, BatchNormalization may not work well in the scarce data.

  • So We also prepare some option to exclude batch-norm.

NOTICE

We are migrating for TF (>= 2.5)
If you interested in this project, feel free and suggest anything.

keras_application_3d's People

Contributors

bbchip0103 avatar

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.