Over the limit

[AI] Facial Expression Recognition ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ๋ฐ ๋ฐ์ดํ„ฐ์…‹ ๋ถ„์„ ๋ณธ๋ฌธ

Etc/AI

[AI] Facial Expression Recognition ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ๋ฐ ๋ฐ์ดํ„ฐ์…‹ ๋ถ„์„

ellapk 2022. 9. 12. 16:36

https://paperswithcode.com/paper/challenges-in-representation-learning-a#code

 

Papers with Code - Challenges in Representation Learning: A report on three machine learning contests

๐Ÿ† SOTA for Facial Expression Recognition on FER2013 (Accuracy metric)

paperswithcode.com

์‚ฌ์šฉ๋œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ž‘ dataset ์„ ๊ฐ๊ฐ ๋ถ„์„ํ•ด๋ณด์ž.

 

 

๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ

 

1. ResidualMaskingNetwork [PyTorch]

https://github.com/phamquiluan/ResidualMaskingNetwork

 

GitHub - phamquiluan/ResidualMaskingNetwork: ICPR 2020: Facial Expression Recognition using Residual Masking Network

ICPR 2020: Facial Expression Recognition using Residual Masking Network - GitHub - phamquiluan/ResidualMaskingNetwork: ICPR 2020: Facial Expression Recognition using Residual Masking Network

github.com

ํ•ด๋‹น ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋Š” ์—ฌ๋А ๊ฐ์ •๋ถ„์„ AI ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์™€ ๊ฐ™์ด, ์ด๋ฏธ์ง€์…‹์„ ๋„ฃ์œผ๋ฉด ๊ทธ ๊ฐ์ •์ด ๋ถ„์„๋˜๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์ž„.

์‚ฌ์šฉ ๋ฐฉ๋ฒ• ๋˜ํ•œ install ํ›„,

from rmn import RMN
m = RMN()
m.video_demo()

# or
image = cv2.imread("some-image-path.png")
results = m.detect_emotion_for_single_frame(image)
print(results)
image = m.draw(image, results)
cv2.imwrite("output.png", image)

๋‹ค์Œ๊ณผ ๊ฐ™์ด ํŒŒ์ด์ฌ ๋‚ด์— ํŒŒ์ผ์„ ๋„ฃ์–ด์คŒ์œผ๋กœ์จ ๋ถ„์„์ด ๋ฐ”๋กœ ๊ฐ€๋Šฅํ•˜๋‹ค.

PyTorch ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ค‘์—์„œ๋Š” ๊ทธ๋‚˜๋งˆ ์‚ฌ์šฉ๋ฅ ์ด ๋†’์€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋‹ค.

 

 

 

 

2. fer [TenserFlow]

https://github.com/justinshenk/fer

 

GitHub - justinshenk/fer: Facial Expression Recognition with a deep neural network as a PyPI package

Facial Expression Recognition with a deep neural network as a PyPI package - GitHub - justinshenk/fer: Facial Expression Recognition with a deep neural network as a PyPI package

github.com

 

1๋ฒˆ์—์„œ ์†Œ๊ฐœํ•œ python ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ณด๋‹จ ์กฐ๊ธˆ ๋” ์ž์„ธํ•œ output ์ œ๊ณต์ด ์ด๋ฃจ์–ด์ง„๋‹ค.

 

Sample output:

[{'box': [277, 90, 48, 63], 'emotions': {'angry': 0.02, 'disgust': 0.0, 'fear': 0.05, 'happy': 0.16, 'neutral': 0.09, 'sad': 0.27, 'surprise': 0.41}]

 

 

์ด๋ฏธ์ง€ ์‚ฌ์šฉ๋ฒ•์€ 1๋ฒˆ๊ณผ ๊ฐ™์€๋ฐ, ์ข€ ๋” ๋‹ค๋ฅธ ํŠน์ง•์ด๋ผ ํ•จ์€ Video ๋ถ„์„ ์ œ๊ณต๋„ ๊ฐ€๋Šฅํ•˜๋‹ค๋Š” ์ ?!

from fer import Video
from fer import FER

video_filename = "tests/woman2.mp4"
video = Video(video_filename)

# Analyze video, displaying the output
detector = FER(mtcnn=True)
raw_data = video.analyze(detector, display=True)
df = video.to_pandas(raw_data)

 

 

 

๋ฐ์ดํ„ฐ์…‹

 

 

FER2013

https://paperswithcode.com/dataset/fer2013

 

Papers with Code - FER2013 Dataset

Fer2013 contains approximately 30,000 facial RGB images of different expressions with size restricted to 48×48, and the main labels of it can be divided into 7 types: 0=Angry, 1=Disgust, 2=Fear, 3=Happy, 4=Sad, 5=Surprise, 6=Neutral. The Disgust expressio

paperswithcode.com

fer2013 ๋ฐ์ดํ„ฐ์…‹์€ ๋Œ€๋žต 3๋งŒ๊ฐœ์˜ 48x48 RGB์ด๋ฏธ์ง€๋“ค์„ ๋ถ„์„ํ•ด์„œ 

0=Angry, 1=Disgust, 2=Fear, 3=Happy, 4=Sad, 5=Surprise, 6=Neutral. ์˜ 7 type์œผ๋กœ ๋ถ„๋ฅ˜ํ•จ.

์–ผ๊ตด ์‚ฌ์ง„๋“ค์„ ์ž๋™์œผ๋กœ ์ค‘์•™ ์ •๋ ฌํ–ˆ๋‹ค๋‹ˆ ์‚ฌ์šฉ์‹œ ๋ฒˆ๊ฑฐ๋กœ์šด ๊ณผ์ •์€ ์—†์„ ๋“ฏ ํ•˜๋‹ค.

 

train.csv ๊ฐ™์€ ๊ฒฝ์šฐ๋Š” ํ•œ ์ด๋ฏธ์ง€๋ฅผ emotion๊ณผ pixel์ด๋ผ๊ณ  ๋‘๊ฐœ๋กœ colum์„ ๋‚˜๋ˆ ์„œ ํ‘œ์‹œํ•จ.

 

 

 

๋†’์€ ๊ธ€๋กœ๋ฒŒ ๋žญํฌ๋ฅผ ๊ธฐ๋กํ•˜๊ณ  ์žˆ๋Š” paper๋“ค์— ์ž์ฃผ ์‚ฌ์šฉ๋˜๊ณ  ์žˆ๋Š” ๋ฐ์ดํ„ฐ์…‹์ธ ๋“ฏ ํ•˜๋‹ค!Facial Expression Recognition ์—ฐ๊ตฌํ•  ๋•Œ ์‚ฌ์šฉํ•˜๊ธฐ์— ์ถฉ๋ถ„ํ•˜๋‹ค๊ณ  ํŒ๋‹จ ๋จ.

 

 

+) ๊ฐœ์ธ์  ๊ฒฌํ•ด

๋‚ด๊ฐ€ ๋ถ„์„ํ•œ Model๋“ค๋ณด๋‹ค ํ•ด๋‹น ์‚ฌ์ดํŠธ์— ๋‚˜์™€์žˆ๋Š” ๋‹ค๋ฅธ Model๋“ค์˜ ํŠธ๋ Œ๋“œ๋‚˜ ์ •ํ™•๋„๊ฐ€ ๋” ๋†’๋‹ค.

๋ฐ์ดํ„ฐ์…‹์€ ๋ณดํ†ต FER2013์„ ๋™์ผํ•˜๊ฒŒ ๋งŽ์ด ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์„ ๋ณด๋‹ˆ, ์†Œ๊ฐœํ•œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋“ค์˜ ์‹ ๋ขฐ๋„๊ฐ€

๊ฒฝ์Ÿ๋ ฅ ์ธก๋ฉด์—์„œ ๋–จ์–ด์ง€๋Š” ๋“ฏ ํ•˜๋‹ค. ์ตœ์‹ ํ™” ๋˜๊ณ  ์ •ํ™•๋„๊ฐ€ ๋†’์€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ๋” ํƒ์ƒ‰ํ•ด ๋ณผ ํ•„์š”๊ฐ€ ์žˆ๋‹ค๊ณ  ๋ด„.

 

'Etc > AI' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[AI] ํผ์…‰ํŠธ๋ก ? ๋…ผ๋ฆฌํšŒ๋กœ?  (0) 2022.06.03