Skip to content

roflseech/unity-image-recognition

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unity image recognition.

image

Mostly suitable for handwritten sketches - when you need to recognize what user has drawn.
Uses Keras for machine learning to train model for your specific dataset, and Barracuda to run model in Unity.
Also has a tool created inside unity that allows you to create dataset fast and easy.

How to use

Dataset preparation

To prepare your dataset you will need to run unity project.
Open DatasetCreator scene, select DatasetCreator object and input folder name.

image

Run the scene and just start drawing on white surface - whenever you hold - draw.
Each time you release mouse - it saves the image to specified folder.

image

Resulted images will be save in Assets/You_folder_name

Training model

Everything related to training is stored in ML folder

Copy folders with images into ML/Data image

Open ML/Final.ipynb

Run the notebook from top to bottom.

image

The model will be saved as Model.onnx, and class names associated with each id will be saved as ClassNames.json

Usage

Create Model Definition scriptable object.

image

Provide model and class names.

image

Open scene Drawing Guesser and provide your Model Definition scriptable object.

image

Run the scene and try to draw!

image

Code usage example you can find in DrawingGuesser.cs

Install as UPM Package for Unity

You can isntall image recognition package for Unity to easily integrate only necessary part for your project:

https://github.com/roflseech/unity-ml-test.git?path=/Assets/ImageRecognition

About

Unity image recognition project. Uses Keras and Barracuda. Suitable mostly for handdrawn sketches.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published