스팸 메일 탐지기와 같은 분류 문제와 같은 방식으로 이미지 분할을 생각할 수 있다. 각 픽셀의
세그먼트 레이블은 픽셀이 속하는 부류
class
에 대한 예측이다. 다차원의 배열을
1
차원으로 반환
하는 넘파이의 .
ravel
() 메서드를 사용하여 분류 작업을 투명하게 처리할 수 있다.
아래의 작은
3
x
3
이미지 분할 예제를 살펴보자.
seg
=
np
.
array
([ [
1
,
1
,
2
],
[
1
,
2
,
2
],
[
3
,
3
,
3
]],
dtype
=
int
)
다음은 이미지를 분할하는 데 사용할 실젯값(
ground
truth
,
gt
)이다.
gt
=
np
.
array
([ [
1
,
1
,
1
],
[
1
,
1
,
1
],
[
2
,
2
,
2
]],
dtype
=
int
)
다음과 같이 두 가지로 분류할 수 있다. 모든 픽셀은 다른 예측이다.
print
(
seg
.
ravel
())
print
(
gt
.
ravel
())
[
1
1
2
1
2
2
3
3
3
]
[
1
1
1
1
1
1
2
2
2
]
COO
형식을 적용하면 다음과 같다.
cont
=
sparse
.
coo
_
matrix
((
np
.
ones
(
seg
.
size
),
(
seg
.
ravel
(),
gt
.
ravel
())))
print
(
cont
)
(
1
,
1
)
1
.
0
(
1
,
1
)
1
.
0
(
2
,
1
)
1
.
0
180
우아한 사이파이 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.
O’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
I wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
I’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
I'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.