@Test public void testInvalidConfig() { Map config = new LinkedHashMap<>(); YoloProcessor ypImageSaver = new YoloProcessor(); try { ypImageSaver.setupImageProcessing(config, SOURCE_NAME, MODEL_DIRECTORY, testAuthToken, testVantiqServer); fail("Should fail without anything in config."); } catch (Exception e) { assertTrue("Failure should be caused by empty config. Error actually was: " + e.getMessage(), e.getMessage().startsWith(YoloProcessor.class.getCanonicalName() + ".missingConfig:")); } config.put("pbFile", PB_FILE); try { ypImageSaver.setupImageProcessing(config, SOURCE_NAME, MODEL_DIRECTORY, testAuthToken, testVantiqServer); fail("Should fail without either a label file or a meta file."); } catch (Exception e) { assertTrue("Failure should be caused by lack of either label or meta file. Error actually was: " + e.getMessage(), e.getMessage().startsWith(YoloProcessor.class.getCanonicalName() + ".missingConfig:")); } config.remove("pbFile"); config.put("labelFile", LABEL_FILE); try { ypImageSaver.setupImageProcessing(config, SOURCE_NAME, MODEL_DIRECTORY, testAuthToken, testVantiqServer); fail("Should fail when label file is included but pbFile is not."); } catch (Exception e) { assertTrue("Failure should be caused by lack of pbFile even when label file is included. Error actually was: " + e.getMessage(), e.getMessage().startsWith(YoloProcessor.class.getCanonicalName() + ".missingConfig:")); } config.remove("labelFile"); config.put("metaFile", META_FILE); try { ypImageSaver.setupImageProcessing(config, SOURCE_NAME, MODEL_DIRECTORY, testAuthToken, testVantiqServer); fail("Should fail when meta file is included but pbFile is not."); } catch (Exception e) { assertTrue("Failure should be caused by lack of pbFile even when meta file is included. Error actually was: " + e.getMessage(), e.getMessage().startsWith(YoloProcessor.class.getCanonicalName() + ".missingConfig:")); } }
@Override public void setupImageProcessing(Map<String, ?> neuralNetConfig, String sourceName, String modelDirectory, String authToken, String server) throws Exception { setup(neuralNetConfig, sourceName, modelDirectory, authToken, server); try { objectDetector = new ObjectDetector(threshold, pbFile, labelsFile, metaFile, anchorArray, imageUtil, outputDir, labelImage, saveRate, vantiq, sourceName); } catch (Exception e) { throw new Exception(this.getClass().getCanonicalName() + ".yoloBackendSetupError: " + "Failed to create new ObjectDetector", e); } }
YoloProcessor extends NeuralNetUtils implements NeuralNetInterface2 { @Override public void setupImageProcessing(Map<String, ?> neuralNetConfig, String sourceName, String modelDirectory, String authToken, String server) throws Exception { setup(neuralNetConfig, sourceName, modelDirectory, authToken, server); try { objectDetector = new ObjectDetector(threshold, pbFile, labelsFile, metaFile, anchorArray, imageUtil, outputDir, labelImage, saveRate, vantiq, sourceName); } catch (Exception e) { throw new Exception(this.getClass().getCanonicalName() + ".yoloBackendSetupError: " + "Failed to create new ObjectDetector", e); } } }
YoloProcessor extends NeuralNetUtils implements NeuralNetInterface2 { @Override public void setupImageProcessing(Map<String, ?> neuralNetConfig, String sourceName, String modelDirectory, String authToken, String server) throws Exception { setup(neuralNetConfig, sourceName, modelDirectory, authToken, server); try { objectDetector = new ObjectDetector(threshold, pbFile, labelsFile, metaFile, anchorArray, imageUtil, outputDir, labelImage, saveRate, vantiq, sourceName); } catch (Exception e) { throw new Exception(this.getClass().getCanonicalName() + ".yoloBackendSetupError: " + "Failed to create new ObjectDetector", e); } }  }
YoloProcessor extends NeuralNetUtils implements NeuralNetInterface2 { @Override public void setupImageProcessing(Map<String, ?> neuralNetConfig, String sourceName, String modelDirectory, String authToken, String server) throws Exception { setup(neuralNetConfig, sourceName, modelDirectory, authToken, server); try { objectDetector = new ObjectDetector(threshold, pbFile, labelsFile, metaFile, anchorArray, imageUtil, outputDir, labelImage, saveRate, vantiq, sourceName); } catch (Exception e) { throw new Exception(this.getClass().getCanonicalName() + ".yoloBackendSetupError: " + "Failed to create new ObjectDetector", e); } }  @Override void setupImageProcessing(Map<String, ?> neuralNetConfig, String sourceName, String modelDirectory, String authToken, String server); @Override NeuralNetResults processImage(byte[] image); @Override NeuralNetResults processImage(byte[] image,  Map<String, ?> request); @Override NeuralNetResults processImage(Map<String, ?> processingParams, byte[] image); @Override NeuralNetResults processImage(Map<String, ?> processingParams, byte[] image, Map<String, ?> request); @Override void close(); }
YoloProcessor extends NeuralNetUtils implements NeuralNetInterface2 { @Override public void setupImageProcessing(Map<String, ?> neuralNetConfig, String sourceName, String modelDirectory, String authToken, String server) throws Exception { setup(neuralNetConfig, sourceName, modelDirectory, authToken, server); try { objectDetector = new ObjectDetector(threshold, pbFile, labelsFile, metaFile, anchorArray, imageUtil, outputDir, labelImage, saveRate, vantiq, sourceName); } catch (Exception e) { throw new Exception(this.getClass().getCanonicalName() + ".yoloBackendSetupError: " + "Failed to create new ObjectDetector", e); } }  @Override void setupImageProcessing(Map<String, ?> neuralNetConfig, String sourceName, String modelDirectory, String authToken, String server); @Override NeuralNetResults processImage(byte[] image); @Override NeuralNetResults processImage(byte[] image,  Map<String, ?> request); @Override NeuralNetResults processImage(Map<String, ?> processingParams, byte[] image); @Override NeuralNetResults processImage(Map<String, ?> processingParams, byte[] image, Map<String, ?> request); @Override void close();  }