INNER CODE UNIT · Python

format_detection

virajmavani/semi-auto-image-annotation-tool · web/backend/main.py:282

        def format_detection(d):
            return {
                "x1": int(d['box'][0]),
                "y1": int(d['box'][1]),
                "x2": int(d['box'][2]),
                "y2": int(d['box'][3]),
                "label": d['label'],
                "score": float(d['score']),
            }

        if model.is_zero_shot():
            if not request.selected_labels:
                return {"detections": []}
            detections = model.predict(preprocessed, text_queries=list(request.selected_labels))
            filtered_detections = [format_detection(d) for d in detections]
        else:
            detections = model.predict(preprocessed)
            filtered_detections = [

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…