All Projects → edouardlp → Mask-RCNN-CoreML

edouardlp / Mask-RCNN-CoreML

Licence: MIT license
Mask-RCNN for Core ML

Programming Languages

swift
15916 projects
python
139335 projects - #7 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to Mask-RCNN-CoreML

prophesee ros wrapper
ROS driver for Prophesee event-based sensors
Stars: ✭ 63 (-45.69%)
Mutual labels:  machine-vision
ESC10-CoreML
An open-source CoreML model trained on the ESC10 dataset
Stars: ✭ 17 (-85.34%)
Mutual labels:  coreml
Vision CoreML-App
This app predicts the age of a person from the picture input using camera or photos gallery. The app uses Core ML framework of iOS for the predictions. The Vision library of CoreML is used here. The trained model fed to the system is AgeNet.
Stars: ✭ 15 (-87.07%)
Mutual labels:  coreml
ios-visionkit-webview
Element detection with Vision Framework and CoreML
Stars: ✭ 26 (-77.59%)
Mutual labels:  coreml
visual-recognition-with-coreml
🕶 Classify images offline using Watson Visual Recognition and Core ML.
Stars: ✭ 40 (-65.52%)
Mutual labels:  coreml
AIBud
An experimental CreateML project for predicting playing musical key and scale in realtime
Stars: ✭ 18 (-84.48%)
Mutual labels:  coreml
MLEdgeDeploy
Automatic Over the Air Deployment of Improved Machine Learning Models to IoT Devices for Edge Processing
Stars: ✭ 26 (-77.59%)
Mutual labels:  coreml
iSpyML
Just another app that looks for NSFW😱 photos into your 'hidden' folder. 🍎 Posts to Facebook timeline is v 2.0 feature.
Stars: ✭ 19 (-83.62%)
Mutual labels:  coreml
iOS11-Demos
Collection of samples and demos of features introduced in iOS 11
Stars: ✭ 16 (-86.21%)
Mutual labels:  coreml
WhoAreYou
Face detection and recognition with CoreML and ARKit
Stars: ✭ 91 (-21.55%)
Mutual labels:  coreml
iOS-CoreML-Inceptionv3
Real-time Object Recognition using Apple's CoreML 2.0 and Vision API -
Stars: ✭ 46 (-60.34%)
Mutual labels:  coreml
ava-capture
Ava Capture is a distributed system to control and record several cameras from a central UI. This system would typically be used for a photogrammetry or 4D capture rig based on Ximea cameras.
Stars: ✭ 52 (-55.17%)
Mutual labels:  machine-vision
CoreML-and-Vision-with-a-pre-trained-deep-learning-SSD-model
This project shows how to use CoreML and Vision with a pre-trained deep learning SSD (Single Shot MultiBox Detector) model. There are many variations of SSD. The one we’re going to use is MobileNetV2 as the backbone this model also has separable convolutions for the SSD layers, also known as SSDLite. This app can find the locations of several di…
Stars: ✭ 16 (-86.21%)
Mutual labels:  coreml
Laser control
Open-Source Laser for control mosquito, weed, and pest
Stars: ✭ 994 (+756.9%)
Mutual labels:  machine-vision
CoreMLDemo
CoreML.framework Demo App
Stars: ✭ 42 (-63.79%)
Mutual labels:  coreml
BootFinder
Boot Finder demonstrates the power of using on-device machine learning models to delight users in new and innovative ways. It's private too! Because this model runs on-device, customer photos never leave the phone!
Stars: ✭ 34 (-70.69%)
Mutual labels:  coreml
digitrecognition ios
Deep Learning with Tensorflow/Keras: Digit recognition based on mnist-dataset and convolutional neural-network on iOS with CoreML
Stars: ✭ 23 (-80.17%)
Mutual labels:  coreml
GestureAI
RNN(Recurrent Nerural network) model which recognize hand-gestures drawing 5 figures.
Stars: ✭ 20 (-82.76%)
Mutual labels:  coreml
loki
Proof-of-concept of emotion-targeted content delivery using machine learning and ARKit.
Stars: ✭ 76 (-34.48%)
Mutual labels:  coreml
speedy-vision
GPU-accelerated Computer Vision for JavaScript.
Stars: ✭ 96 (-17.24%)
Mutual labels:  machine-vision

Mask-RCNN for CoreML

Mask-RCNN using Core ML, Metal 2 and Accelerate.

Example

Mask-RCNN

Mask-RCNN is a general framework for object instance segmentation. It detects objects, the class they belong to, their bounding box and segmentation masks.

Motivation

Mask-RCNN is not fast, especially with the current ResNet101 + FPN backbone.

There are much faster models for object detection such as SSDLite and YOLO.

This model will only be useful if instance segmentation is valuable for your use-case.

Examples

Example 1 Example 2 Example 3

Requirements

  • Xcode 10.1
  • iOS 12 or macOS 10.14 device with Metal support
  • Swift 4.2
  • (More requirements details coming soon)

Requirements for using the scripts

  • Docker
  • (More requirements details coming soon)

iOS Example Project Usage

  1. Checkout or download this repository
  2. Open a shell and navigate (cd) to the root of the repository
  3. Download the pre-trained model files using the command:
$ swift run maskrcnn download example
  1. Open Example/iOS Example.xcodeproj
  2. Build and run on an iOS 12 device with Metal support

Installation

Cocoapods

Coming soon. See Roadmap. Install Manually instead.

Carthage

Coming soon. See Roadmap. Install Manually instead.

Swift Package Manager

Coming soon. See Roadmap. Install Manually instead.

Manually

  1. Import all of the Swift files in the Sources/Mask-RCNN-CoreML/ directory
  2. If you have your own data to train or fine-tune a model, or if you have your own model weights, see Converting or training your own model. Otherwise, see Using COCO pre-trained model to use my model.

Using COCO pre-trained model

  1. Download the pre-trained model files from the releases page. (instructions for conversion coming soon)
  2. Make the code you use is associated
  3. Drag the four files into your Xcode project (anchors.bin, MaskRCNN.mlmodel, Mask.mlmodel, Classifier.mlmodel)

Converting or training your own model

If you have pre-trained model weights, or if you have data you want to train the model with, follow the instructions in this section.

Converting pre-trained weights

At the moment, only models trained using Matterport's Mask-RCNN implementation are supported. If your model is trained differently, you may be able to get it to work by renaming your weights following Matterport's naming structure and exporting your model to the Keras HDF5 format.

You should also specify configuration options in a JSON file.

  • architecture : The backbone architecture your model is trained with. "resnet101" or "resnet50". Defaults to "resnet101".
  • input_image_shape : The shape of the input image as a list of numbers. Defaults to [1024,1024,3].
  • num_classes : The number of classes, including the background class. Defaults to 81.
  • pre_nms_max_proposals : The number of proposed regions to evaluate using NMS. Only the top pre_nms_max_proposals proposals by score will be evaluated. Defaults to 6000.
  • max_proposals : The number of proposals to classify. Only the top proposals by score, after NMS, will be evaluated. Defaults to 1000.
  • More options to come

To use the default directory structure, place your files as such:

.maskrcnn/
    models/
        your_model_name/
            model/
                config.json
                weights.h5

The products of the conversion will be placed as such :

.maskrcnn/
    models/
        your_model_name/
            products/
                anchors.bin
                MaskRCNN.mlmodel
                Mask.mlmodel
                Classifier.model

Run :

$ swift run maskrcnn convert <your_model_name>

If you want to use input files located elsewhere, or to output the model to another directory, simply run :

$ swift run maskrcnn convert <your_model_name> --config=<path_to_config_file> --weights=<path_to_weights_file> --output_dir=<path_to_output_dir>

Training or fine-tuning a model

This is not supported at the moment, but the next item in my roadmap.

Evaluating the model accuracy

After conversion, or training you may want to evaluate the model accuracy.

At the moment, only the COCO dataset can be used for evaluation.

To use the default directory structure, place your files as such:

.maskrcnn/
    data/
        coco/
            the_coco_annotation_files.json
            type_year(ex: val2017)/
                the_images.jpg
    models/
        your_model_name/
            products/
                anchors.bin
                MaskRCNN.mlmodel
                Mask.mlmodel
                Classifier.model

Run :

$ swift run maskrcnn eval coco <your_model_name> --year=<coco dataset year> --type=<coco dataset type ex : val>

If you want to compare against the model using Tensorflow, place the model files as such :

.maskrcnn/
    models/
        your_model_name/
            model/
                config.json
                weights.h5

Use -c to compare

$ swift run maskrcnn eval coco <your_model_name> -c --year=<coco dataset year> --type=<coco dataset type ex : val>

If you want to have your files in custom locations :

$ swift run maskrcnn eval coco <your_model_name> -c  --year=<coco dataset year> --type=<coco dataset type ex : val> --config=<path_to_config_file> --weights=<path_to_weights_file> --products_dir=<path_to_products_dir>

Roadmap

  • Training and fine-tuning support
  • Cocoapods, Carthage, Swift Package manager and improved documentation
  • Mobile-optimized backbone and other performance optimizations
  • Easy training support
  • Support for custom evaluation datasets
  • Support for pose estimation

Author

Édouard Lavery-Plante, [email protected]

Credits

References

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].