세그멘테이션용의 라벨(마스크)을 labelme로 작성하는 방법(semantic segmentation mask)

↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

전제 지식
다음 지식이 있다고 가정하여 기사를 작성합니다.
labelme은 라벨 작성용 앱
이런 느낌의 앱입니다.
labelme 사용법 상세
labelme 다운로드
어렵지 않기 때문에 생략
labelme으로 라벨 지정
labelme을 열면 다음과 같은 창이 열립니다. (이미지는 google 검색 화면의 스크린 샷입니다.

확대하면서 포인트로 선을 그립니다.
확대와 이동은 매우 쉽게 할 수 있습니다.

이 적당한 느낌으로 1min 정도일까.
꽤 사용하기 쉽습니다. .

왼쪽 SAVE에서 JSON을 저장합니다.
이런 느낌의 데이터를 할 수 있습니다!
{
"version": "4.5.6",
"flags": {},
"shapes": [
{
"label": "dog",
"points": [
[
104.36893203883496,
66.99029126213593
],
[
93.44660194174757,
71.35922330097087
],
ここは省略
[
112.13592233009709,
74.27184466019418
],
[
107.28155339805825,
73.30097087378641
]
],
"group_id": null,
"shape_type": "polygon",
"flags": {}
}
],
"imagePath": "スクリーンショット 2020-09-14 141400.png",
"imageData": "省略",
"imageHeight": 405,
"imageWidth": 535
}
주의! 이 JSON 포인트는 폴리곤의 포인트이므로 그대로 마스크에는 사용할 수 없습니다. . 그래서이 포인트를 마스크로 변환해야합니다.
labelme 파일을 JSON에서 MASK로 변환
당초 스스로 구현하려고 했는데, 그것에 대한 함수가 준비되어 있었습니다.
labelme은 utils 폴더에 shape.py라는 모듈을 제공하며 shape_to_mask 함수를 사용하여 JSON에서 MASK로 변환할 수 있습니다.
다만, 미묘하게 실장하지 않으면 안 되므로, 샘플의 코드를 실어 둡니다.
import json
with open(path, "r",encoding="utf-8") as f:
dj = json.load(f)
# dj['shapes'][0]は今回一つのラベルのため。
mask = shape_to_mask((dj['imageHeight'],dj['imageWidth']), dj['shapes'][0]['points'], shape_type=None,line_width=1, point_size=1)
mask_img = mask.astype(np.int)#booleanを0,1に変換
#anacondaを使っています
import matplotlib.pyplot as plt
%matplotlib inline
plt.imshow(mask_img)

잘 라벨링 할 수있었습니다.
이 정도의 레벨이라면, 이미지 열고 나서 보존까지로 2-3min 정도로 할 수 있는 것은 아닐까요.
마지막으로
labelme 이외에 추천 라벨링 도구 있으면 알려주세요.
상당히 독자적으로 구현하거나 하고 있는 사람도 있는 것일까.
Reference
이 문제에 관하여(세그멘테이션용의 라벨(마스크)을 labelme로 작성하는 방법(semantic segmentation mask)), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/a__/items/72be9c078ae3fe337bb4
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
{
"version": "4.5.6",
"flags": {},
"shapes": [
{
"label": "dog",
"points": [
[
104.36893203883496,
66.99029126213593
],
[
93.44660194174757,
71.35922330097087
],
ここは省略
[
112.13592233009709,
74.27184466019418
],
[
107.28155339805825,
73.30097087378641
]
],
"group_id": null,
"shape_type": "polygon",
"flags": {}
}
],
"imagePath": "スクリーンショット 2020-09-14 141400.png",
"imageData": "省略",
"imageHeight": 405,
"imageWidth": 535
}
import json
with open(path, "r",encoding="utf-8") as f:
dj = json.load(f)
# dj['shapes'][0]は今回一つのラベルのため。
mask = shape_to_mask((dj['imageHeight'],dj['imageWidth']), dj['shapes'][0]['points'], shape_type=None,line_width=1, point_size=1)
mask_img = mask.astype(np.int)#booleanを0,1に変換
#anacondaを使っています
import matplotlib.pyplot as plt
%matplotlib inline
plt.imshow(mask_img)
Reference
이 문제에 관하여(세그멘테이션용의 라벨(마스크)을 labelme로 작성하는 방법(semantic segmentation mask)), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/a__/items/72be9c078ae3fe337bb4텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)