3D Shape Detection System

Shape detection techniques are an important aspect of computer vision and are used to transform raw image data into the symbolic representations needed for object recognition and location.

Photo by Aleksei Vasileika on Dribbble


In this article, a notebook is presented which contains the development of a system that detects four types of 3D shapes — Cube, Cylinder, Spheroid and Sphere.


The model used is built on top of mobilenet v1, leveraging the benefits of transfer learning inorder to build an a light weight but accurate CNN model.


Its implementation is done on the Cainvas Platform, which provides seamless execution of python notebooks to build AI systems which can eventually be deployed on the edge (i.e an embedded system such as compact MCUs).

The notebook can be found here.



Mobilenet v1 — Base Model

MobileNets are based on a streamlined architecture that uses depth-wise separable convolutions to build light weight deep neural networks.

The purpose behind using mobilenet for this use case is that, this project is intended to be deployed on mobile devices on the edge, hence making perfect sense to build a model based on a class of efficient models (MobileNets) that were pre-trained to suite deployment of Fine-Tuned DNN models for mobile and embedded vision applications.


Loading MobileNet:

base_model = MobileNet ( input_shape = 
    (
        IMAGE_SIZE, 
        IMAGE_SIZE,
        3
    ), 
    alpha=ALPHA, 
    depth_multiplier = 1, 
    dropout = 0.001, 
    include_top = False, 
    weights = "imagenet", 
    classes = 4, 
    backend = keras.backend,
    layers = keras.layers,
    models = keras.models,
    utils = keras.utils
 )

Here the model parameters are set