Giter Club home page Giter Club logo

Comments (31)

Jimut123 avatar Jimut123 commented on September 26, 2024 1

Working on GRAD-CAM version 2. Merged: keras-team/keras-io#399

Need some initial motivation from here: https://github.com/YassineYousfi/comma10k-baseline
Also need to look how the robust model performs on these datasets:

from cellseg.

Jimut123 avatar Jimut123 commented on September 26, 2024 1

Hey @heraldofsolace I forgot about this task... is this done?
https://colab.research.google.com/drive/16LMsoN0y__pAEVcrqzIb9bJ8y2Fogv7_?usp=sharing

Problem: Classification Model with the following specifications

Task:

  • Use data generator from Keras to do data augmentation with a batch size of 24, probably in Google Colab for now.
  • Make sure to find/ check the data distribution (using histograms from matplotlib) first, and if there is any class imbalance and stuff, then we have to take necessary actions, and ask for help.
  • Split the data to 80-10-10 (80% training, 10% validation and 10% test).
  • Record Precision, Recall, Accuracy, Loss, F1 score on datasets, i.e., training, validation and test sets. This can be done using scikit learn.
  • Plot all the graphs obtained and display the same.
  • Make a confusion matrix plot it using Matplotlib

TODO

  • K-Fold cross validation

from cellseg.

heraldofsolace avatar heraldofsolace commented on September 26, 2024 1

Working on it but I feel dumb lol

from cellseg.

heraldofsolace avatar heraldofsolace commented on September 26, 2024 1

Screenshot_20210315_105735

from cellseg.

Jimut123 avatar Jimut123 commented on September 26, 2024 1

https://colab.research.google.com/drive/16LMsoN0y__pAEVcrqzIb9bJ8y2Fogv7_?usp=sharing
A very simple skeleton is here, but it needs to be modified a lot

from cellseg.

heraldofsolace avatar heraldofsolace commented on September 26, 2024 1

Why? LOL

Well, it's your model

from cellseg.

Jimut123 avatar Jimut123 commented on September 26, 2024 1

Oh, so it won't obey you 🌚

from cellseg.

heraldofsolace avatar heraldofsolace commented on September 26, 2024

🥺

from cellseg.

Jimut123 avatar Jimut123 commented on September 26, 2024

Yes

from cellseg.

Jimut123 avatar Jimut123 commented on September 26, 2024

Also need to build slides, deadline - 14 th March. Need to discuss about that soon...

from cellseg.

Jimut123 avatar Jimut123 commented on September 26, 2024

@heraldofsolace Probably suggest a good name for this repo xD

from cellseg.

Jimut123 avatar Jimut123 commented on September 26, 2024

Lol Tamal Mj's Laptop's CUDA just messed up for some reason, I need to fix that tomorrow... Let's see. Studying few papers today.

from cellseg.

heraldofsolace avatar heraldofsolace commented on September 26, 2024

from cellseg.

Jimut123 avatar Jimut123 commented on September 26, 2024

Lol

from cellseg.

heraldofsolace avatar heraldofsolace commented on September 26, 2024

In the set "ig" has 4 different types of things "IG", "MMY", "MY", "PMY" and Neutrphil has 3 different types "BNE", "SNE" and "Neutrophil"

from cellseg.

Jimut123 avatar Jimut123 commented on September 26, 2024

I have seen that before, thought that 8 classes will be good, but eventually we need them too. What would be better? Having a classifier to screen the first 8 classes first and then from that we will use different screening techniques? Or what do you suggest?

This is the cell glossary we will get from the slides

Blast (Bl)
Promyelocyte (PM)
Myelocyte (My)
Metamyelocyte (Me)
Band form  (Band) (Not a cell)
Neutrophil (N)
Eosinophil (Eo)
Basophil (Ba)
Lymphocyte (L)
Monocyte (Mo)
Nucleated RBC (NRBC)

from cellseg.

Jimut123 avatar Jimut123 commented on September 26, 2024

data_plot

from cellseg.

heraldofsolace avatar heraldofsolace commented on September 26, 2024

I was thinking, maybe take them all as separate classes and separately augment them until they reach 2000 samples or something and combine into one dataset.

from cellseg.

Jimut123 avatar Jimut123 commented on September 26, 2024

So let's do that then. What techniques will you use?

  • color jittering
  • flips
  • zoom
  • blurring(?)
  • maybe noise (?)
  • maybe (small) random crop of some image into a particular image
  • rotation
  • affine (?)

I was even thinking of doing an ensemble with polar transformation and FFT, but that will be too much for now

from cellseg.

heraldofsolace avatar heraldofsolace commented on September 26, 2024

Let's first write the baseline code and then we'll add more augmentation as needed.

from cellseg.

heraldofsolace avatar heraldofsolace commented on September 26, 2024

So, the generator doesn't actually balance the classes. Using the generator we can't control the number of samples in classes. So we have two options -

  1. Accept the imbalance and set the model weight accordingly instead with augmentation.
  2. Use a dummy training run with augmentation to generate augmented image and create a larger dataset.

I think the 2nd approach would not be good as there is huge imbalance and some of the classes would just be full of slightly different images.

from cellseg.

Jimut123 avatar Jimut123 commented on September 26, 2024

from cellseg.

heraldofsolace avatar heraldofsolace commented on September 26, 2024

Ok

from cellseg.

Jimut123 avatar Jimut123 commented on September 26, 2024

Aniket, If you have some scripts to run related to the project (say 100 epochs), you can give me.

from cellseg.

heraldofsolace avatar heraldofsolace commented on September 26, 2024

https://colab.research.google.com/drive/1s1WgkH0DG2BPHJnG11UTSBLRz0h1CGms?usp=sharing

It predicts everything as BNE lol

from cellseg.

Jimut123 avatar Jimut123 commented on September 26, 2024

Why? LOL

from cellseg.

Jimut123 avatar Jimut123 commented on September 26, 2024
def Model_V2_Gradcam(H,W,C):

    input_layer = tf.keras.Input(shape=(H, W, C))
    x_1 = tf.keras.layers.Conv2D(16, 3, activation='relu', strides=(1, 1), name="conv_16_1", padding='same', kernel_initializer = 'he_normal', kernel_regularizer=l2(1e-4))(input_layer)
    x_2 = tf.keras.layers.Conv2D(16, 3, activation='relu', strides=(1, 1), name="conv_16_2", padding='same', kernel_initializer = 'he_normal', kernel_regularizer=l2(1e-4))(x_1)
    # x_4 = tf.keras.layers.Conv2D(16, 3, activation='relu', strides=(1, 1), name="conv_64_21", padding='same')(add([x_3,x_1]))
    x_3 = tf.keras.layers.MaxPooling2D((2, 2), name="max_pool3")(x_2)
    x_4 = tf.keras.layers.Conv2D(32, 3, activation='relu', strides=(1, 1), name="conv_32_1", padding='same', kernel_initializer = 'he_normal', kernel_regularizer=l2(1e-4))(x_3)
    x_5 = tf.keras.layers.Conv2D(32, 3, activation='relu', strides=(1, 1), name="conv_32_2", padding='same', kernel_initializer = 'he_normal', kernel_regularizer=l2(1e-4))(x_4)

    x_6 = tf.keras.layers.MaxPooling2D((2, 2), name="max_pool4")(x_5)
    x_7 = tf.keras.layers.Conv2D(64, 3, activation='relu', strides=(1, 1), name="conv_64_1", padding='same', kernel_initializer = 'he_normal', kernel_regularizer=l2(1e-4))(x_6)
    x_8 = tf.keras.layers.Conv2D(64, 3, activation='relu', strides=(1, 1), name="conv_64_2", padding='same', kernel_initializer = 'he_normal', kernel_regularizer=l2(1e-4))(x_7)
    x = tf.keras.layers.MaxPooling2D((2, 2), name="max_pool5")(x_8)
    x = tf.keras.layers.Conv2D(64, 3, activation='relu', strides=(2, 2), name="conv_64_3", kernel_initializer = 'he_normal', kernel_regularizer=l2(1e-4))(x)
    x = tf.keras.layers.MaxPooling2D((2, 2), name="max_pool6")(x)
    x = tf.keras.layers.Flatten(name="flatten")(x)
    x = tf.keras.layers.Dropout(0.15, name="dropout_3")(x)
    x = tf.keras.layers.Dense(256, activation='relu', name="dense_64")(x)
    x = tf.keras.layers.Dense(N_LABELS, activation='softmax', name="output_layer")(x)

    model = tf.keras.models.Model(inputs=input_layer, outputs=x)
    return model

model = Model_V2_Gradcam(H=360, W=360, C=3)

model.compile(optimizer='adam', loss='categorical_crossentropy',
            metrics= ['accuracy'])
model.summary()

from cellseg.

Jimut123 avatar Jimut123 commented on September 26, 2024

I told you it needs multiple screening models, one model needs to be too deep to understand the minor variations between the classes, so ends up doing nothing

from cellseg.

Jimut123 avatar Jimut123 commented on September 26, 2024

https://www.kaggle.com/paultimothymooney/identify-blood-cell-subtypes-from-images

from cellseg.

heraldofsolace avatar heraldofsolace commented on September 26, 2024

Oof

from cellseg.

Jimut123 avatar Jimut123 commented on September 26, 2024

Why? LOL

Well, it's your model

Looks like the primitive one should work better. Not tested though.

def Model_V1_Gradcam(H,W,C):
    input_layer = tf.keras.Input(shape=(H, W, C))
    x = tf.keras.layers.Conv2D(32, 3, activation='relu', strides=(2, 2), name="conv_32")(input_layer)
    x = tf.keras.layers.MaxPooling2D((2, 2), name="max_pool1")(x)
    x = tf.keras.layers.Conv2D(64, 3, activation='relu', strides=(2, 2), name="conv_64")(x)
    x = tf.keras.layers.MaxPooling2D((2, 2), name="max_pool2")(x)
    x = tf.keras.layers.Conv2D(64, 3, activation='relu', strides=(2, 2), name="conv_64_2")(x)
    x = tf.keras.layers.MaxPooling2D((2, 2), name="max_pool3")(x)
    
    x = tf.keras.layers.Flatten(name="flatten")(x)
    x = tf.keras.layers.Dense(512, activation='relu', name="dense_512")(x)
    x = tf.keras.layers.Dropout(0.5, name="dropout_1")(x)
    x = tf.keras.layers.Dense(512, activation='relu', name="dense_256")(x)
    x = tf.keras.layers.Dropout(0.5, name="dropout_2")(x)
    x = tf.keras.layers.Dense(128, activation='relu', name="dense_64")(x)
    x = tf.keras.layers.Dropout(0.5, name="dropout_3")(x)
    
    x = tf.keras.layers.Dense(N_LABELS, activation='softmax', name="output_layer")(x)
    #x = tf.keras.layers.Reshape((1, N_LABELS))(x)
    
    model = tf.keras.models.Model(inputs=input_layer, outputs=x)
    return model

model = Model_V1_Gradcam(H=360, W=360, C=3)

model.compile(optimizer='adam', loss='categorical_crossentropy',
            metrics= ['accuracy'])
model.summary()

from cellseg.

Related Issues (14)

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.