Code Monkey home page Code Monkey logo

ac295-final-project-jwi's People

Contributors

ianhi avatar jennyhuangg 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

Watchers

 avatar  avatar

ac295-final-project-jwi's Issues

Do not hardcode mask shape in on_select

Currently the image shape is hardcoded in on_select

def onselect(self,verts):
self.verts = verts
p = Path(verts)
self.indices = p.contains_points(self.pix, radius=0).reshape(450,540)
self.updateArray()
self.fig.canvas.draw_idle()

this is bad because it will always fail with differently shaped images. This should be fixed to use the shape of the current image.

run using-model-example.ipynb occur errors

seg_interactive = segmentation(PATH,LABELS)
Which backbone model do you want to use?
-'mobilenet' or 'mobilenetv2': efficient and light for real-word application
-'inceptionv3': Deep Convolutional Neural Network with sparsely connected architecture developped by Google (using different types of convolutional blocks at each layer)
-'resnet18','resnet34','resnet50','resnet101' or'resnet152': core idea of this model is 'identity shortcut connection' that skips one or more layers
We encourage you to try mobilenet first to see if it is sufficient for your segmentation task
mobilenet

Which loss function do you want to use ?
-'cross_entropy': fastest to compute,
-'dice_loss': Overlap measure that performs better at class imbalanced problems
-'focal_loss' : To down-weight the contribution of easy examples so that the CNN focuses more on hard examples
Could also be a mix of those loss functions
Examples :

  • cross_entropy + dice_loss
  • dice_loss + focal_loss
    cross_entropy
    Do you want Data Augmentation ? Yes or No
    yes
    Do you want to use pre-trained weights trained on Imagenet for the encoder ?
    Yes or No
    yes

What is your batch_size ?
6

What is your steps_per_epoch ?
For guidance, you have 12 training images and a chosen batch_size of 6
Normally (with many images), the steps_per_epoch is equal to Nbr_training_images//batch_size==2
However, if you have a few images, you could increase that number because you'll have data augmentation
10

How many epochs do you want to run ?
20

Do you want to freeze the encoder layer ? Yes or No
No
Found 12 images belonging to 1 classes.
Found 12 images belonging to 1 classes.
Found 1 images belonging to 1 classes.
Found 1 images belonging to 1 classes.


OSError Traceback (most recent call last)
in
----> 1 seg_interactive = segmentation(PATH,LABELS)

/mnt/code/AC295-final-project-JWI/lib/Segmentation.py in init(self, PATH, CLASSES, target_size, params)
78 self.create_datagenerator(PATH)
79 #Model
---> 80 self.model = sm.Unet(self.backbone, encoder_weights=self.weights_pretrained,classes=self.n_classes, activation=self.activation, encoder_freeze=self.encoder_freeze)
81
82 try:

~/miniconda3/envs/segmentation/lib/python3.8/site-packages/segmentation_models/init.py in wrapper(*args, **kwargs)
32 kwargs['models'] = _KERAS_MODELS
33 kwargs['utils'] = _KERAS_UTILS
---> 34 return func(*args, **kwargs)
35
36 return wrapper

~/miniconda3/envs/segmentation/lib/python3.8/site-packages/segmentation_models/models/unet.py in Unet(backbone_name, input_shape, classes, activation, weights, encoder_weights, encoder_freeze, encoder_features, decoder_block_type, decoder_filters, decoder_use_batchnorm, **kwargs)
219 'Got: {}'.format(decoder_block_type))
220
--> 221 backbone = Backbones.get_backbone(
222 backbone_name,
223 input_shape=input_shape,

~/miniconda3/envs/segmentation/lib/python3.8/site-packages/segmentation_models/backbones/backbones_factory.py in get_backbone(self, name, *args, **kwargs)
101 def get_backbone(self, name, *args, **kwargs):
102 model_fn, _ = self.get(name)
--> 103 model = model_fn(*args, **kwargs)
104 return model
105

~/miniconda3/envs/segmentation/lib/python3.8/site-packages/classification_models/models_factory.py in wrapper(*args, **kwargs)
76 modules_kwargs = self.get_kwargs()
77 new_kwargs = dict(list(kwargs.items()) + list(modules_kwargs.items()))
---> 78 return func(*args, **new_kwargs)
79
80 return wrapper

~/miniconda3/envs/segmentation/lib/python3.8/site-packages/keras_applications/mobilenet.py in MobileNet(input_shape, alpha, depth_multiplier, dropout, include_top, weights, input_tensor, pooling, classes, **kwargs)
294 weight_path,
295 cache_subdir='models')
--> 296 model.load_weights(weights_path)
297 elif weights is not None:
298 model.load_weights(weights)

~/miniconda3/envs/segmentation/lib/python3.8/site-packages/tensorflow/python/keras/engine/training.py in load_weights(self, filepath, by_name, skip_mismatch)
248 raise ValueError('Load weights is not yet supported with TPUStrategy '
249 'with steps_per_run greater than 1.')
--> 250 return super(Model, self).load_weights(filepath, by_name, skip_mismatch)
251
252 def compile(self,

~/miniconda3/envs/segmentation/lib/python3.8/site-packages/tensorflow/python/keras/engine/network.py in load_weights(self, filepath, by_name, skip_mismatch)
1257 'first, then load the weights.')
1258 self._assert_weights_created()
-> 1259 with h5py.File(filepath, 'r') as f:
1260 if 'layer_names' not in f.attrs and 'model_weights' in f:
1261 f = f['model_weights']

~/miniconda3/envs/segmentation/lib/python3.8/site-packages/h5py/_hl/files.py in init(self, name, mode, driver, libver, userblock_size, swmr, rdcc_nslots, rdcc_nbytes, rdcc_w0, track_order, **kwds)
404 with phil:
405 fapl = make_fapl(driver, libver, rdcc_nslots, rdcc_nbytes, rdcc_w0, **kwds)
--> 406 fid = make_fid(name, mode, userblock_size,
407 fapl, fcpl=make_fcpl(track_order=track_order),
408 swmr=swmr)

~/miniconda3/envs/segmentation/lib/python3.8/site-packages/h5py/_hl/files.py in make_fid(name, mode, userblock_size, fapl, fcpl, swmr)
171 if swmr and swmr_support:
172 flags |= h5f.ACC_SWMR_READ
--> 173 fid = h5f.open(name, flags, fapl=fapl)
174 elif mode == 'r+':
175 fid = h5f.open(name, h5f.ACC_RDWR, fapl=fapl)

h5py/_objects.pyx in h5py._objects.with_phil.wrapper()

h5py/_objects.pyx in h5py._objects.with_phil.wrapper()

h5py/h5f.pyx in h5py.h5f.open()

OSError: Unable to open file (truncated file: eof = 57344, sblock->base_addr = 0, stored_eof = 17225924)

Use mpl-interactions for zoom_factory, panhandler, and image_segmenter

All three of those functions were ultimately extracted and new improved versions of them live in the pip installable library mpl-interactions in this file: https://github.com/ianhi/mpl-interactions/blob/master/mpl_interactions/generic.py

They are documented:

This project should make use of those functions as they have a few improvements and will continue to be actively maintained.

If anyone sees this and wants to try you are more than welcome to open a PR (even if you didn't fully finish the process and need some help)

Model Not Predicting Mask Properly

Hi, when I am following this tutorial on my own dataset, the training predictions are not properly predicting a mask. What could be the root of this problem? Thanks!

problem

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.