Coder Social home page Coder Social logo

nyukat / birads_classifier Goto Github PK

View Code? Open in Web Editor NEW
147.0 15.0 58.0 74.75 MB

High-resolution breast cancer screening with multi-view deep convolutional neural networks

Home Page: https://arxiv.org/abs/1703.07047

License: BSD 2-Clause "Simplified" License

Python 100.00%
breast-cancer pretrained-models bi-rads classification tensorflow pytorch

birads_classifier's Issues

Birads 3 Categories

Hello , i'm using this repository for my school project 'Breast cancer classification using mammoram pictures' the project is working perfectly
my question is why it shows only 3 birads categories while birads got 7 categories ?
Thank you for reading my question ๐Ÿ‘

PyTorch model has two-views instead of four?

Hello there,

In the paper you say that the model has four views and that the pipelines for four views are separate until global average pool and then concatenated. Something like following ASCII art:

R-MLO  |-a1-|-a2-|-a3-|--|--|--|--|--|--| \
L-MLO  |-b1-|-b2-|-b3-|--|--|--|--|--|--|\ \
                                           > >--|--|--|--|
R-CC   |-c1-|-c2-|-c3-|--|--|--|--|--|--|/ /
L-CC   |-d1-|-d2-|-d3-|--|--|--|--|--|--| /

But when I look at the layers for the python model, for MLO and CC, only one layer is defined for each one, instead of two. In the forward phase both MLO and CC images are put forward through same layer. Something like:

L-CC  \           \           \
       \|-a1-/|-a1-\|-a2-/|-a2-\|-a3-/|-a3-|... 
R-CC        /           /           /

Which creates a bizarre architecture like:

R-MLO  |-a1-|-a2-|-a3-|--|--|--|--|--|--| \
L-MLO  |-a1-|-a2-|-a3-|--|--|--|--|--|--|\ \
                                           > >--|--|--|--|
R-CC   |-b1-|-b2-|-b3-|--|--|--|--|--|--|/ /
L-CC   |-b1-|-b2-|-b3-|--|--|--|--|--|--| /

Here is the code for conv. layers taken from layers_torch.py

    def __init__(self, in_channels, number_of_filters=32, filter_size=(3, 3), stride=(1, 1)):
        super(AllViewsConvLayer, self).__init__()
        self.cc = nn.Conv2d(
            in_channels=in_channels,
            out_channels=number_of_filters,
            kernel_size=filter_size,
            stride=stride,
        )
        self.mlo = nn.Conv2d(
            in_channels=in_channels,
            out_channels=number_of_filters,
            kernel_size=filter_size,
            stride=stride,
        )

    def forward(self, x):
        return {
            "L-CC": F.relu(self.cc(x["L-CC"])),    # [Addition] (1)
            "L-MLO": F.relu(self.mlo(x["L-MLO"])),
            "R-CC": F.relu(self.cc(x["R-CC"])),    # [Addition] (2)
            "R-MLO": F.relu(self.mlo(x["R-MLO"])),
        }

Notice that in lines (1) and (2) L-CC and R-CC is forwarded from the same layer. Also the same issue for R-MLO and L-MLO.

Here is what I get when I try to reach for the first layer in the model, there is only two conv layers instead of four. Therefore, the model effectively has two views, not four.

model._conv_layer_ls[0]
Out[20]: 
AllViewsConvLayer(
  (cc): Conv2d(1, 32, kernel_size=(3, 3), stride=(2, 2))
  (mlo): Conv2d(1, 32, kernel_size=(3, 3), stride=(2, 2))
)

For TF however, the layers seems to be in line with the paper:

def all_views_conv_layer(input_layer, layer_name, number_of_filters=32, filter_size=(3, 3), stride=(1, 1),
                         padding='VALID', biases_initializer=tf.zeros_initializer()):
    """Convolutional layers across all 4 views"""
  
    input_l_cc, input_r_cc, input_l_mlo, input_r_mlo = input_layer

    with tf.variable_scope(layer_name + "_CC") as cc_cope:
        h_l_cc = tf.contrib.layers.convolution2d(inputs=input_l_cc, num_outputs=number_of_filters,
                                                 kernel_size=filter_size, stride=stride, padding=padding,
                                                 scope=cc_cope, biases_initializer=biases_initializer)
        h_r_cc = tf.contrib.layers.convolution2d(inputs=input_r_cc, num_outputs=number_of_filters,
                                                 kernel_size=filter_size, stride=stride, padding=padding, reuse=True,
                                                 scope=cc_cope, biases_initializer=biases_initializer)

    with tf.variable_scope(layer_name + "_MLO") as mlo_cope:
        h_l_mlo = tf.contrib.layers.convolution2d(inputs=input_l_mlo, num_outputs=number_of_filters,
                                                  kernel_size=filter_size, stride=stride, padding=padding,
                                                  scope=mlo_cope, biases_initializer=biases_initializer)
        h_r_mlo = tf.contrib.layers.convolution2d(inputs=input_r_mlo, num_outputs=number_of_filters,
                                                  kernel_size=filter_size, stride=stride, padding=padding, reuse=True,
                                                  scope=mlo_cope, biases_initializer=biases_initializer)

    h = (h_l_cc, h_r_cc, h_l_mlo, h_r_mlo)

    return h

Is this perhaps an oversight or am I missing something? Does this pytorch model achieve similar accuracy in the dataset?

Thanks.

Source code

Dear Krzysztof,

we are working on a similar projet and struggle using high resolution pictures in our neuronal network.
as we understand, you have managed to bypass this problem and explain the way you did it in your paper. What an amazing job!

Is there a chance that you share your source code with us in order for us to understand how you have implemented the concept in your code.

We would be more than greatful :-).

We are looking forward to read from you,

Image normalization

Hello,

Thank you for making this code available!

My question is regarding data preprocessing. I noticed that the example images you provide in the images directory have values in the range 0 - 255. Is this how you scaled the training images? Other than the whitening mentioned in the paper (subtracting the mean and dividing by the standard deviation), what other preprocessing did you apply during training and inference (e.g. adaptive histogram equalization)?

Thanks,
-Richard

dataset

Is this dataset public available?

Could I use the models you provide to retrain my data set directly?

Excuse me,I want to use the method of transfer learning to retrain the model you provided.Should I divide my dataset to 4 parts because there are 4 views?I don't know how to do before retrain the models.Could you give me some advice?

Thank you!
Looking forward to your reply!

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.