Java Vehicle Detector Example

Initialize vehicle detector model

import org.sertiscorp.oneml.alpr.*;
VehicleDetector detector = new VehicleDetector();

Initialize vehicle detector model with licensing

import org.sertiscorp.oneml.alpr.*;
LicenseManager licenseManager = new LicenseManager();
licenseManager.setKey("LICENSE_KEY_VALUE_HERE");
licenseManager.activateKey();
VehicleDetector detector = new VehicleDetector(licenseManager);

Initialize oneML’s Utils

Utils utils = new Utils();

Initialize oneML’s Utils with licensing

Utils utils = new Utils(licenseManager);

Read input as BufferedImage

BufferedImage img = ImageIO.read(file);
List<BufferedImage> imgs = Arrays.asList(img);
ImageBatch batch = new ImageBatch().add(imgs);

Read input as oneML’s Image

Image img = utils.readImageCV(filePath);

Run the model

VehicleDetectorResultList results = detector.detect(batch);

or

VehicleDetectorResult result = detector.detect(img);

And get the output

FloatList scores = output.getScores();
BBoxList bboxes = output.getBBoxes();
int size = output.getSize();
StatusCodeList statuses = output.getReturnStatus();

Cleanup

detector.delete();
utils.delete();