Home

Awesome

Creative Machine

A Machine Learning library for Processing. Visit Creative Machine website for more information about the library.

Install

Install using the contribution manager in Processing application.

Install in Processing App

API Reference

Visit our documentation website 🤖

Build

Run gradle to build a new release package under /release/creative_machine.zip:

# windows
gradlew.bat releaseProcessingLib

# mac / unix
./gradlew releaseProcessingLib

Developing in IntelliJ IDEA

The library can be imported as an IntelliJ project following the steps below:

import processing.core.*;
import ml.*;

public class DetectTest extends PApplet {
    ObjectDetector detector;
    PImage img;

    public void settings() {
        size(parseInt(args[0]), parseInt(args[1]));
    }

    public void setup() {
        detector = new ObjectDetector(this, "coco_ssd");
        img = loadImage("dog_bike_car.jpeg");
        MLObject[] output = detector.detect(img, "output.png");
        // print a label and confidence score of each object
        for (int i = 0; i < output.length; i++) {
            println(output[i].getLabel() + " detected! (confidence: " + output[i].getConfidence() + ")");
        }
    }

    public void draw() {
       // draw a bounding box of each object
       image(img, 0, 0);
       noFill();
       stroke(255, 0, 0);
       for (int i = 0; i < output.length; i++) {
           MLObject obj = output[i];
           rect(obj.getX(), obj.getY(), obj.getWidth(), obj.getHeight());
       }
    }

    static public void main(String[] args) {
      PApplet.main(DetectTest.class, "768", "576");
    }
}

Please note that the input image should be placed inside the subdirectory data located inside the root of the IntelliJ project (i.e.: ml-dev/data)