Giter Site home page Giter Site logo

segmentation_experiments's Introduction

segmentation_experiments

BSRP summer internship project attempting to streamline nucleus segmentation

segmentation_experiments's People

Contributors

eric-bueno avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

segmentation_experiments's Issues

Crop Images

  • Take 64x64x3 shaped crops of images
  • Normalize dataset by taking the same number of crops across all image types

Optimize composites.py

  • create tensor to hold entire mask collection (similar to a cube)
  • combine all layers in a single numpy function (vs the current for loop)
  • multiply cube by a vector (similar to i+1) to give each slice it's own color
  • collapse the cube into a single matrix again (numpy.sum(axis='z'))

Data Augmentation (regression)

  • Downscale images that are equal to a given bin to every bin below it
    • only upscale to no more than 10 bins above it
  • Generate more crops for larger bins with less examples
  • Plot distribution of sizes after all these transformations
    • ideally, sizes should be uniformly distributed

Composite Mask images

Composite of all nucleus masks of one image into a single matrix (labeled matrix in scikit-image).

Average size of nuclei in images

Given the masks of nuclei in an image, compute the average size of those masks.

  • Separate this code in a new module called sizes.py
  • Create a different notebook to test the functionality.

Reorganize modules in a package and rename notebooks

Create a directory called functions (for now) and move all the Python modules (.py files) there. Then make sure that all your notebooks run by updating the imports from import xxx to import functions.xxx. Perhaps you need to create an empty __init__.py file.

Rename your notebooks with a two digit number to keep track of the order in which they should be run. For instance: 01_preprocessing.ipynb and 02_tensorflow_experiment.ipynb, and so on.

Implement an image rescaling function

The goal is to have a function that gets an image, the ground truth composite and the target average object size as parameters and returns a new image with a new composite both rescaled to a new size that approximates the requested average object size. It would look like this:

rescaled_image, rescaled_composite = FUNCTION(image, composite, target_size)

The calculations that the function needs to make are:

  • Current average object size.
  • Ratio of current size (cs) and target object size (ts) as follows: ratio=cs/ts
  • Use the skimage.transform.rescale function to transform the image and the composite
  • Return the result

Verify visually and numerically that the object size of the rescaled images is close to the target size.

Regression Function

  • similar pipeline to color classification
  • Load composite of masks for each image to get the ground truth
  • Extend crop function to get crop of image and mask composite
  • With these crops, compute average size of nucleus
  • Do not need to keep composites for training, just need to create the label
  • Make sure code is robust; can it handle a blank crop (no nuclei in image)
  • Neural network should work the same
  • Except the Dense layer output will only be one: we just need the size
  • Use absolute error loss function (or square error)
  • Metric is error, not accuracy

Verify Color Predictions

  • Represent the color model's predictions in a graph
  • Show how the model displays confidence for each prediction

Switch from TensorFlow to PyTorch

  • Investigate how to transition from tf to PyTorch
  • Recreate color classification experiment using PyTorch
  • Create new notebook(s) for these experiments

OFA Integration

  • Clone OFA repo
  • Use a pre-built sub-net to analyze images
    ex) v100 to identify and elephant, note10 to do the same
  • ignore losses, top1, top5; we only want to classify a single image
  • run experiments in a new notebook

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.