kognic-openlabel
1 분
이 OpenLABEL json 스키마를 사용하여 어노테이션을 더 쉽게 다룰 수 있도록 kognic-openlabel 이라는 Python 패키지를 만들었습니다. 이 Python 패키지는 OpenLABEL 포맷을 pydantic 모델로 표현하며, 다음과 같이 설치할 수 있습니다.
pip install --upgrade kognic-openlabelpydantic을 사용하므로, 이 모델은 검증(validation) 기능과 직렬화/역직렬화 메서드를 함께 제공합니다. 아래는 서로 다른 포맷 간에 손쉽게 변환하는 방법에 대한 예제입니다.
openlabel_dict = {
"openlabel": {
"metadata": {
"schema_version": "1.0.0"
}
}
}
from kognic.openlabel.models import OpenLabelAnnotation
# Deserialize dict
openlabel_annotation = OpenLabelAnnotation.model_validate(openlabel_dict)
# Serialize to json
openlabel_json = openlabel_annotation.model_dump_json(exclude_none=True)
# Deserialize json
openlabel_annotation = OpenLabelAnnotation.model_validate_json(openlabel_json)
# Serialize to dict
openlabel_dict = openlabel_annotation.model_dump(exclude_none=True)