moorage / OpenCVTensorflowExample

Object Detection using a ssd_mobilenet_coco model with OpenCV 3.3 & TensorFlow 1.4 in C++ and XCode
https://medium.com/greppy/object-detection-using-a-ssd-mobilenet-coco-model-with-opencv-3-3-tensorflow-1-4-in-c-and-xcode-28b3e1d955db
39 stars 12 forks source link

Mask RCNN example #2

Closed samhodge closed 6 years ago

samhodge commented 6 years ago

Do you have the ability to process the segmentation from a mask RCNN example.

That would be really useful.

Sam

moorage commented 6 years ago

Not nicely written up, but here's the snippet: https://github.com/matterport/Mask_RCNN/issues/222#issuecomment-373130661

samhodge commented 6 years ago

Do you have a .pb file ready to go that matches with that model, or do I need to convert the materport myself? if so can I find the steps on that thread?

samhodge commented 6 years ago

https://github.com/ericj974/Mask_RCNN/blob/master/scripts/export_model.py this should make one for me, just need to get my Python toolchain up and running.

samhodge commented 6 years ago

Nearly there, using the matterport master and converting using ericj974 branch I get the following error

libc++abi.dylib: terminating with uncaught exception of type std::runtime_error: Expected mask dimensions to be [1,100,28,28,2] but got: [1,100,28,28,81]

Any ideas?

I would send you my .pb, but I dont know where to upload it to.

samhodge commented 6 years ago

Here is my export script

import scripts.export_model
import config

import coco
class InferenceConfig(coco.CocoConfig):
    # Set batch size to 1 since we'll be running inference on
    # one image at a time. Batch size = GPU_COUNT * IMAGES_PER_GPU
    GPU_COUNT = 1
    IMAGES_PER_GPU = 1

config = InferenceConfig()

scripts.export_model.export(config,scripts.MODEL_DIR ,scripts.COCO_MODEL_PATH)

Using https://github.com/ericj974/Mask_RCNN/blob/master/scripts/export_model.py

with the v1.0 Matterport .h5 file from:

https://github.com/matterport/Mask_RCNN/releases actually it might be the v2.0 version. let me go back and check I am trying to upload my .pb file for you to have a look but Australian internet is slow.

samhodge commented 6 years ago

OK here is the .pb file I made with the process above: https://drive.google.com/drive/folders/13LMELrHFvq1AU6-S7h8ZzPUqgO8C5pbi?usp=sharing

samhodge commented 6 years ago

https://github.com/moorage/OpenCVTensorflowExample/commit/29f3bc9d77118549023559a3d8dd46003d3eae13 this is where I am up to I really dont have much idea what I am doing.

moorage commented 6 years ago

Hey Sam -- I'm sorry that I don't have time at the moment to help.

samhodge commented 6 years ago

Thanks for responding

Allen-wg commented 5 years ago

This url https://github.com/ericj974/Mask_RCNN/blob/master/scripts/export_model.py is not exists, who can give a right link. Thank you!

chengaohua commented 5 years ago

@Allen-wg https://github.com/ericj974/Mask_RCNN/blob/master/scripts/export.py

Allen-wg commented 5 years ago

@Allen-wg https://github.com/ericj974/Mask_RCNN/blob/master/scripts/export.py

Got it ,Thank you! I have translate .h5 file to .pb file,when I use opencv3.4.4 to call my .pb model file, a new problem have arisen,as shown below: cvNet=cv2.dnn.readNetFromTensorflow('mask_rcnn_playground_1000.pb') Traceback (most recent call last): File "", line 1, in cv2.error: OpenCV(3.4.4) /io/opencv/modules/dnn/src/tensorflow/tf_importer.cpp:996: error: (-215:Assertion failed) haveConst in function 'populateNet' Do you have a perfect solution?