PhantomEngine-Logo-Icon-W-Text.png

Docs

Docs       Manual       Reference       Changelog       Main Site

Manual

Object Recognition

The Object Recognition module uses computer vision algorithms to bring Object Detection to your applications.

info.png

Running on Windows requires a webcam.

Set Up

  1.  Set up Phantom Scene. (See: Setup Guide)
     

  2. Drag and drop the ObjectRecognition prefab into your scene.
     

  3. Include ObjectRecognitionParameters in PhantomSettings.cs
     

  4. Use Object Recognition by calling ObjectRecognition.Instance in your scripts. Include PhantomTech.ML namespace.
     

  5. If running on Windows, from the editor, select the Game Tab(next to Scene Tab) and set the aspect ratio to whatever your WebCams aspect ratio is, most likely 1920x1080.

Note: It’s vital that StreamingAssets/dnn are inside your asset folder. Otherwise Object Recognition will cause crashes when trying to run the editor.

Configuration and Debugging

The Object Recognition module is powered by the one-stage object detection model YOLO (You Only Look Once). Specifically the model in use is yolov4-tiny. To view what objects can be detected, open yolov4-tiny.names as a .txt, which can be found inside StreamingAssets/dnn/yolov4-tiny.names. To learn more about YOLOv4 check out: https://github.com/AlexeyAB/darknet.

Configuring Object Recognition can be done by modifying Default Object Recognition Parameters from the PhantomSettings GameObject.

If you are experienced with using YOLO and would like to run your own model/s, you can do so by placing your model files inside StreamingAssets/dnn and changing the appropriate YOLO Neural Network files. Only recommended to use Yolov3 and Yolov4 models.

Configure the network by raising the network’s confidence thresholds to increase the accuracy of the model's inference. Lower to increase the quantity of detections.

Increase the Nms Confidence threshold to lower duplicate bounding boxes being created.

A debugging tool is provided to ensure the model is working correctly. By having the Debugging Box checked, GUI boxes will appear on the screen when successful detections occur.

OR-1.JPG

Bounding Boxes - is a serialized list of Bounding Box objects to ensure detections are occurring. When accessing bounding boxes from your code, a copy of this list will be passed as accessing/modifying the list directly can lead to undefined behaviours. When running on Windows, all detections will be displayed in this list.

OR-2.JPG

Using Object Recognition

Using Object Recognition within your applications is quite easy and straightforward. All public methods and fields can be accessed from a singleton (Step 4 of Setup and Configuration), after ObjectRecognition.cs has been placed into the scene.

OR-3.JPG
OR-4.JPG