Giter Club home page Giter Club logo

coco-semantic-segmentation's Introduction

COCO-Semantic-Segmentation

A COCO image and masks generator tutorial for semantic segmentation purposes.

For a detailed explanation of code and concepts, refer to these medium posts:

Part 1 | Part 2

Refer to the demo jupyter notebook for the self-explanatory code.

coco-semantic-segmentation's People

Contributors

virafpatrawala 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  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  avatar

coco-semantic-segmentation's Issues

consistent pixel value for an object

Hi, Thank you for creating this tutorial. I'm wondering if there is a way to modify the script so that each pixel value for an object is the same. For example, if I have an object that is category id 4, the current script produces a mask that has values of 0, 1, 2, 3, 4. But I want all pixels to be either 0 (background) or 4 (object).

I tried modifying the script to do this, but I'm pretty confused when it comes to using the coco library.

Thank you

ValueError when trying to make mask out of annotations

I get the following error whenever I try to run coco.annToMask(anns[i]):

ValueError: Buffer has wrong number of dimensions (expected 1, got 2).

All I was doing was following the code exactly. It was working one day, then all of a sudden it wasn't the next. Anyone know how to resolve this?

Thanks,
Sam

Problem

@virafpatrawala Hi, first of all thanks for your article. I think your code is all I need to finish my project. I need to transform a json file with a lot of annotations for different images into segmentation masks png's, and also I thin I'm going to use your data augmentation part too.

I'm not using coco images but my own dataset with coco annotations and I got this error

Captura de ecrã 2021-08-08, às 20 56 11

My dataset have images of 550x550 pixels but I got the same error when I inserted that number in the input_image_size

Thank you for your time

Miguel

Error while training with the U-NET Model

2 root error(s) found.
(0) UNKNOWN: Exception: input type is not supported.
Traceback (most recent call last):

File "/home/navneeth/anaconda3/lib/python3.9/site-packages/tensorflow/python/ops/script_ops.py", line 270, in call
ret = func(*args)

File "/home/navneeth/anaconda3/lib/python3.9/site-packages/tensorflow/python/autograph/impl/api.py", line 642, in wrapper
return func(*args, **kwargs)

File "/home/navneeth/anaconda3/lib/python3.9/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 1030, in generator_py_func
values = next(generator_state.get_iterator(iterator_id))

File "/home/navneeth/anaconda3/lib/python3.9/site-packages/keras/engine/data_adapter.py", line 831, in wrapped_generator
for data in generator_fn():

File "/tmp/ipykernel_235356/1226860277.py", line 14, in augmentationsGenerator
for img, mask in gen:

File "/tmp/ipykernel_235356/728327123.py", line 25, in dataGeneratorCoco
train_mask = getNormalMask(imageObj, classes, coco, catIds, input_image_size)

File "/tmp/ipykernel_235356/2567587607.py", line 29, in getNormalMask
new_mask = cv2.resize(coco.annToMask(anns[a])*pixel_value, input_image_size)

File "/home/navneeth/anaconda3/lib/python3.9/site-packages/pycocotools/coco.py", line 442, in annToMask
rle = self.annToRLE(ann)

File "/home/navneeth/anaconda3/lib/python3.9/site-packages/pycocotools/coco.py", line 427, in annToRLE
rles = maskUtils.frPyObjects(segm, h, w)

File "pycocotools/_mask.pyx", line 308, in pycocotools._mask.frPyObjects

Exception: input type is not supported.

 [[{{node PyFunc}}]]
 [[IteratorGetNext]]
 [[IteratorGetNext/_4]]

(1) UNKNOWN: Exception: input type is not supported.
Traceback (most recent call last):

File "/home/navneeth/anaconda3/lib/python3.9/site-packages/tensorflow/python/ops/script_ops.py", line 270, in call
ret = func(*args)

File "/home/navneeth/anaconda3/lib/python3.9/site-packages/tensorflow/python/autograph/impl/api.py", line 642, in wrapper
return func(*args, **kwargs)

File "/home/navneeth/anaconda3/lib/python3.9/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 1030, in generator_py_func
values = next(generator_state.get_iterator(iterator_id))

File "/home/navneeth/anaconda3/lib/python3.9/site-packages/keras/engine/data_adapter.py", line 831, in wrapped_generator
for data in generator_fn():

File "/tmp/ipykernel_235356/1226860277.py", line 14, in augmentationsGenerator
for img, mask in gen:

File "/tmp/ipykernel_235356/728327123.py", line 25, in dataGeneratorCoco
train_mask = getNormalMask(imageObj, classes, coco, catIds, input_image_size)

File "/tmp/ipykernel_235356/2567587607.py", line 29, in getNormalMask
new_mask = cv2.resize(coco.annToMask(anns[a])*pixel_value, input_image_size)

File "/home/navneeth/anaconda3/lib/python3.9/site-packages/pycocotools/coco.py", line 442, in annToMask
rle = self.annToRLE(ann)

File "/home/navneeth/anaconda3/lib/python3.9/site-packages/pycocotools/coco.py", line 427, in annToRLE
rles = maskUtils.frPyObjects(segm, h, w)

File "pycocotools/_mask.pyx", line 308, in pycocotools._mask.frPyObjects

Exception: input type is not supported.

 [[{{node PyFunc}}]]
 [[IteratorGetNext]]

0 successful operations.
0 derived errors ignored. [Op:__inference_train_function_3047]

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.