in cvat-serverless/functions/endpoints/pth_rcnn.py [0:0]
def call(data):
buf = io.BytesIO(base64.b64decode(data["image"]))
threshold = float(data.get("threshold", 0.5))
predicts = infer(buf)
results = []
for i in range(len(predicts)):
obj_score = predicts[i]['score']
if obj_score >= threshold:
results.append({
"confidence": str(obj_score),
"label": list(predicts[i].keys())[0],
"points": list(predicts[i].values())[0],
"type": "rectangle",
})
return JsonResponse(results, safe=False)