Buckets:
| """Serialize complete tile detections in source-image coordinates.""" | |
| def capture_tile(x, y, width, height, polygons, classes, confidences, mapping): | |
| if not (len(polygons) == len(classes) == len(confidences)): | |
| raise ValueError("prediction arrays have different lengths") | |
| predictions = [] | |
| for polygon, source_class, confidence in zip(polygons, classes, confidences): | |
| if len(polygon) != 4 or any(len(point) != 2 for point in polygon): | |
| raise ValueError("expected four x/y vertices") | |
| class_id = int(source_class) | |
| points = [coordinate for point in polygon | |
| for coordinate in (float(point[0]) + x, float(point[1]) + y)] | |
| predictions.append({"source_class_id": class_id, | |
| "category_id": mapping.get(class_id), | |
| "confidence": float(confidence), | |
| "obb_polygon": points}) | |
| return {"origin": [x, y], "size": [width, height], "predictions": predictions} | |
Xet Storage Details
- Size:
- 1.01 kB
- Xet hash:
- 4b44c09f3d2957b089a81ac3aa5a35097a9bf4279033ae0ca661d3ef74156cfe
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.