Skip to content

Commit

Permalink
share: Add a bunch of models.
Browse files Browse the repository at this point in the history
  • Loading branch information
kwagyeman committed Nov 23, 2024
1 parent dbe85fc commit e399892
Show file tree
Hide file tree
Showing 163 changed files with 18,437 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ dist/clang/patches/*.patch -diff -merge -text
*.inf binary
share/qtcreator/node/** binary
share/qtcreator/python/** binary
*.tflite binary
# OPENMV-DIFF #
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"0": "Age"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import numpy as np
import json
from sys import float_info


class PostProcessor:
def __init__(self, json_config):
self._json_config = json.loads(json_config)
self._label_json_config = self._json_config["POST_PROCESS"][0]["LabelsPath"]
self._reg_scale = self._json_config["POST_PROCESS"][0].get("RegScale", 1.0)
self._reg_offset = self._json_config["POST_PROCESS"][0].get("RegOffset", 0.0)
with open(self._label_json_config, "r") as json_file:
self._labels = json.load(json_file)

def forward(self, tensor_list, details_list):
qp = details_list[0]["quantization_parameters"]
scale = qp["scales"][0]
offset = qp["zero_points"][0]

value_dequant = (float(np.squeeze(tensor_list[0])) - offset) * scale
value = value_dequant * self._reg_scale + self._reg_offset

if np.isnan(value):
value = float_info.max

if np.isinf(value):
value = float(np.clip(value, float_info.min, float_info.max))

results = [{"label": self._labels["0"], "score": value}]
return json.dumps(results)
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"ConfigVersion": 6,
"Checksum": "494ffeffb5c9ef6d4dd3cfdc30e37da6e2aca31ab29c110a572fa37a9c92e104",
"DEVICE": [
{
"DeviceType": "CPU",
"RuntimeAgent": "TFLITE",
"SupportedDeviceTypes": "TFLITE/ARMNN, TFLITE/CPU"
}
],
"PRE_PROCESS": [
{
"InputN": 1,
"InputType": "Image",
"InputResizeMethod": "bilinear",
"InputPadMethod": "crop-last",
"ImageBackend": "auto",
"InputH": 256,
"InputW": 256,
"InputC": 3,
"InputQuantEn": true,
"InputQuantOffset": 0,
"InputQuantScale": 0.00392156862745098,
"InputImgNormEn": true,
"InputImgNormCoeff": 0.00392156862745098,
"InputNormMean": [
0,
0,
0
],
"InputNormStd": [
1,
1,
1
],
"InputTensorLayout": "NHWC",
"InputImgSliceType": "None"
}
],
"MODEL_PARAMETERS": [
{
"ModelPath": "yolov8n_relu6_age--256x256_quant_tflite_multidevice_1.tflite"
}
],
"POST_PROCESS": [
{
"OutputPostprocessType": "Classification",
"PostProcessorInputs": [
1
],
"OutputNumClasses": 1,
"LabelsPath": "labels_yolov8n_relu6_age.json",
"OutputClassIDAdjustment": 0,
"RegScale": 15.666666666666666,
"RegOffset": 1,
"PythonFile": "regression.py"
}
]
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"0": "Female",
"1": "Male"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"Checksum": "63450ba42c23c16025aba224b4253b22cc1de9fa400e23fb0813f1d6236be12b",
"ConfigVersion": 6,
"DEVICE": [
{
"DeviceType": "CPU",
"RuntimeAgent": "TFLITE",
"SupportedDeviceTypes": "TFLITE/ARMNN, TFLITE/CPU"
}
],
"MODEL_PARAMETERS": [
{
"ModelPath": "yolov8n_relu6_gender--160x160_quant_tflite_multidevice_1.tflite"
}
],
"POST_PROCESS": [
{
"LabelsPath": "labels_yolov8n_relu6_gender.json",
"OutputClassIDAdjustment": 0,
"OutputConfThreshold": 0.3,
"OutputNumClasses": 2,
"OutputPostprocessType": "Classification",
"OutputSoftmaxEn": false,
"OutputTopK": 5,
"PostProcessorInputs": [
1
]
}
],
"PRE_PROCESS": [
{
"ImageBackend": "auto",
"InputC": 3,
"InputH": 160,
"InputImgNormCoeff": 0.00392156862745098,
"InputImgNormEn": true,
"InputImgSliceType": "None",
"InputN": 1,
"InputNormMean": [
0,
0,
0
],
"InputNormStd": [
1,
1,
1
],
"InputPadMethod": "crop-last",
"InputQuantEn": true,
"InputQuantOffset": 0,
"InputQuantScale": 0.00392156862745098,
"InputResizeMethod": "bilinear",
"InputTensorLayout": "NHWC",
"InputType": "Image",
"InputW": 160
}
]
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"0": "Female",
"1": "Male"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"Checksum": "23241da79e561b88e55a3eb3a8daade0622b3fbf90f28d64e7d987b84790cb47",
"ConfigVersion": 6,
"DEVICE": [
{
"DeviceType": "CPU",
"RuntimeAgent": "TFLITE",
"SupportedDeviceTypes": "TFLITE/ARMNN, TFLITE/CPU"
}
],
"MODEL_PARAMETERS": [
{
"ModelPath": "yolov8n_relu6_gender--256x256_quant_tflite_multidevice_1.tflite"
}
],
"POST_PROCESS": [
{
"LabelsPath": "labels_yolov8n_relu6_gender.json",
"OutputClassIDAdjustment": 0,
"OutputConfThreshold": 0.3,
"OutputNumClasses": 2,
"OutputPostprocessType": "Classification",
"OutputSoftmaxEn": false,
"OutputTopK": 5,
"PostProcessorInputs": [
1
]
}
],
"PRE_PROCESS": [
{
"ImageBackend": "auto",
"InputC": 3,
"InputH": 256,
"InputImgNormCoeff": 0.00392156862745098,
"InputImgNormEn": true,
"InputImgSliceType": "None",
"InputN": 1,
"InputNormMean": [
0,
0,
0
],
"InputNormStd": [
1,
1,
1
],
"InputPadMethod": "crop-last",
"InputQuantEn": true,
"InputQuantOffset": 0,
"InputQuantScale": 0.00392156862745098,
"InputResizeMethod": "bilinear",
"InputTensorLayout": "NHWC",
"InputType": "Image",
"InputW": 256
}
]
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"0": "Car"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"ConfigVersion": 6,
"Checksum": "b9d7bad8b6893f826716e9cfb6941ad5936f7ef947bcee70f1179229cbcc6515",
"DEVICE": [
{
"DeviceType": "CPU",
"RuntimeAgent": "TFLITE",
"SupportedDeviceTypes": "TFLITE/ARMNN, TFLITE/CPU"
}
],
"PRE_PROCESS": [
{
"InputN": 1,
"InputType": "Image",
"InputResizeMethod": "bilinear",
"InputPadMethod": "letterbox",
"ImageBackend": "auto",
"InputH": 640,
"InputW": 640,
"InputC": 3,
"InputQuantEn": true,
"InputQuantOffset": 0,
"InputQuantScale": 0.00392156862745098,
"InputImgNormEn": true,
"InputImgNormCoeff": 0.00392156862745098,
"InputNormMean": [
0,
0,
0
],
"InputNormStd": [
1,
1,
1
],
"InputTensorLayout": "NHWC",
"InputImgSliceType": "None"
}
],
"MODEL_PARAMETERS": [
{
"ModelPath": "yolov5n_relu6_car--640x640_quant_tflite_multidevice_1.tflite"
}
],
"POST_PROCESS": [
{
"OutputPostprocessType": "DetectionYolo",
"PostProcessorInputs": [
227,
230,
228,
229
],
"OutputNumClasses": 1,
"LabelsPath": "labels_yolov5n_relu6_car.json",
"OutputClassIDAdjustment": 0,
"OutputNMSThreshold": 0.6,
"MaxDetectionsPerClass": 100,
"MaxClassesPerDetection": 1,
"UseRegularNMS": true,
"OutputConfThreshold": 0.3,
"MaxDetections": 100
}
]
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"0": "person",
"1": "bicycle",
"2": "car",
"3": "motorcycle",
"4": "airplane",
"5": "bus",
"6": "train",
"7": "truck",
"8": "boat",
"9": "traffic light",
"10": "fire hydrant",
"11": "stop sign",
"12": "parking meter",
"13": "bench",
"14": "bird",
"15": "cat",
"16": "dog",
"17": "horse",
"18": "sheep",
"19": "cow",
"20": "elephant",
"21": "bear",
"22": "zebra",
"23": "giraffe",
"24": "backpack",
"25": "umbrella",
"26": "handbag",
"27": "tie",
"28": "suitcase",
"29": "frisbee",
"30": "skis",
"31": "snowboard",
"32": "sports ball",
"33": "kite",
"34": "baseball bat",
"35": "baseball glove",
"36": "skateboard",
"37": "surfboard",
"38": "tennis racket",
"39": "bottle",
"40": "wine glass",
"41": "cup",
"42": "fork",
"43": "knife",
"44": "spoon",
"45": "bowl",
"46": "banana",
"47": "apple",
"48": "sandwich",
"49": "orange",
"50": "broccoli",
"51": "carrot",
"52": "hot dog",
"53": "pizza",
"54": "donut",
"55": "cake",
"56": "chair",
"57": "couch",
"58": "potted plant",
"59": "bed",
"60": "dining table",
"61": "toilet",
"62": "tv",
"63": "laptop",
"64": "mouse",
"65": "remote",
"66": "keyboard",
"67": "cell phone",
"68": "microwave",
"69": "oven",
"70": "toaster",
"71": "sink",
"72": "refrigerator",
"73": "book",
"74": "clock",
"75": "vase",
"76": "scissors",
"77": "teddy bear",
"78": "hair drier",
"79": "toothbrush"
}
Loading

0 comments on commit e399892

Please sign in to comment.