A-SW Hub / Repositories
Local Gitea · READ ONLY
← 저장소 Repositories
REPOSITORY

metafarmers/fruit-work-target-perception Private

[참조 MVP] 과채류 작업대상 인식 — RGB-D 관측에서 과실과 생장점을 식별하고 로봇 작업 후보를 구조화하는 참조 MVP입니다.

https://git.agrithing.ai/metafarmers/fruit-work-target-perception.git
4 commits
2 items · feat/concrete-mvp-v2
·/ asw_component/component.py
python · 1.5 KB · 4d4bed2 Download
from __future__ import annotationsSUPPORTED = {"fruit": 1, "growth-tip": 2}def execute(payload: dict) -> dict:    if not isinstance(payload, dict):        raise ValueError("payload must be an object")    threshold = float(payload.get("threshold", 0.8))    if not 0 <= threshold <= 1:        raise ValueError("threshold must be between 0 and 1")    candidates = []    rejected = 0    for observation in payload.get("observations", []):        kind = observation.get("kind")        confidence = float(observation.get("confidence", 0))        position = observation.get("positionMm")        if kind not in SUPPORTED or confidence < threshold or not isinstance(position, list) or len(position) != 3:            rejected += 1            continue        candidates.append({            "id": observation["id"], "kind": kind, "confidence": round(confidence, 4),            "positionMm": [float(value) for value in position], "priority": SUPPORTED[kind],        })    candidates.sort(key=lambda item: (-item["priority"], -item["confidence"], item["id"]))    counts = {kind: sum(item["kind"] == kind for item in candidates) for kind in SUPPORTED}    accepted = bool(candidates)    return {"component": "metafarmers/fruit-work-target-perception", "accepted": accepted,            "status": "TARGETS_READY" if accepted else "NO_TARGETS", "target": "vpu",            "frameId": str(payload.get("frameId", "unknown")), "candidates": candidates,            "counts": counts, "rejected": rejected}