This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- recognitions.add( | |
- new Recognition( | |
- "" + i, | |
- labels.get((int) outputClasses[0][i] + labelOffset), | |
- outputScores[0][i], | |
- detection)); | |
+ final int classLabel = (int) outputClasses[0][i] + labelOffset; | |
+ if (inRange(classLabel, labels.size(), 0) && inRange(outputScores[0][i], 1, 0)) { | |
+ recognitions.add( | |
+ new Recognition( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Configuration values for the prepackaged SSD model. | |
private static final int TF_OD_API_INPUT_SIZE = 300; | |
private static final boolean TF_OD_API_IS_QUANTIZED = false; | |
private static final String TF_OD_API_MODEL_FILE = "detect.tflite"; | |
private static final String TF_OD_API_LABELS_FILE = "file:///android_asset/labelmap.txt"; | |
private static final DetectorMode MODE = DetectorMode.TF_OD_API; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import glob | |
import cv2 | |
if __name__ == "__main__": | |
import argparse | |
parser = argparse.ArgumentParser( | |
description="Resize raw images to uniformed target size." | |
) |