🏆 Winner of Apple worldwide Swift Student Challenge 2020 Award
BlockDraw is a game, especially for kids, where they have to create the said object only using three basic shapes, i.e. Rectangle, Triangle and Round. The purpose of BlockDraw is to develop understanding of basic shapes and forming new shapes and more complex objects by placing those basic shapes, positioning them in meaningful ways and modifying various shape-specific parameters.
BlockDraw is built entirely using Swift and Apple's native frameworks and technologies like: SwiftUI, Core ML, Create ML, Core Image, Vision, SpriteKit, AVFoundation
The User Interface:
The user interface of the playground is developed in SwiftUI which enabled things like smooth animations when repositioning & resizing shapes, adjusting other parameters with the custom designed sliders and more in an elegant way. On the top of that, the intro animations are done using SpriteKit and thanks to the SwiftUI again which helps to enable seamless transitions from SpriteKit scenes to SwiftUI view.
Evaluating the created object:
When the user clicks on the 'Evaluate' button, an image of Canvas is captured. The Core Image framework helps preprocess the image by applying filters on it to remove any colors that might get captured due to selection of shapes.
The processed image is passed to a custom Core ML image classifier which is trained using Create ML with a special dataset. The output from the model will be a category in which the image is classified and the confidence of same. As per the confidence level of the label predicted, the output is presented to the user indicating whether their drawing is okay, along with other information like which and how many shapes are used to make the said object.
The Special Dataset:
For the dataset, I have developed an equivalent playground of this; It is slightly modified from this playground, where there's a button which instead of passing the image captured of canvas to the model, it gets saved locally as an image file. I have prepared a dataset of 105 images like this to train the model which can classify the images into the following categories: Home, Car, Camera, Cell Phone, Computer and Seesaw. (The dataset will be available publicly soon)
As of now, the Core ML model is trained with a limited number of images and a small dataset. Though it performs quite well, it can be improved even more with a larger dataset covering even more styles of structures for each category. Moreover, the dataset can also be expanded by introducing even more objects which can be easily formed using these three shapes only. Other than improving underlying machine learning model of evaluation, it can have even more features, like creating colorful objects to have an even more enjoyable experience, especially for kids. Unfortunately, I don't own an iPad yet, but I believe that this interface have a great potential to deliver an amazing experience equally on a touch first interface as in mouse and trackpad interface.