Posts [My project] ๊ธด๊ธ‰์ „ํ™” 1818
Post
Cancel

[My project] ๊ธด๊ธ‰์ „ํ™” 1818

๐ŸŒˆ 2020 IBM hackathone : Call for Code Korea ๐ŸŒŽ

ํŒ€๋ช… : 1818

ํŒ€์žฅ : ๊น€ํ˜ธ์—ฐ

ํŒ€์› : ๊ณฝ์„ธ๊ฒฝ, ๋ฐ•ํ˜„์šฐ, ์ตœ๋ฏธ๋ฆฌ, ์ตœ์ •์›

์ฃผ์ œ : AI๊ธฐ๋ฐ˜ ๊ณต๊ณต์ „ํ™” ์—ฐ๊ฒฐ ์„œ๋น„์Šค โ€œ1818โ€

1818ํŒ€ ํšŒ์˜ ๋…ธ์…˜

0. ์ฝœ ํฌ ์ฝ”๋“œ(Call for code) ๋ž€?

  • โ€˜์ฝœ ํฌ ์ฝ”๋“œ(Call for Code)โ€™ ๊ธ€๋กœ๋ฒŒ ์ฑŒ๋ฆฐ์ง€๋Š” ์ธ๊ณต ์ง€๋Šฅ, ๋ธ”๋ก์ฒด์ธ, ํด๋ผ์šฐ๋“œ, IoT ๋“ฑ์˜ ์ •๋ณดํ†ต์‹ ๊ธฐ์ˆ (ICT)์„ ํ™œ์šฉํ•˜์—ฌ ๊ฐ€์žฅ ์‹ฌ๊ฐํ•œ ๋ฌธ์ œ๋กœ ๋Œ€๋‘๋œ ๊ธ€๋กœ๋ฒŒ ์ด์Šˆ์˜ ํ•ด๋ฒ•์„ ์ฐพ๋Š” ์ „ ์„ธ๊ณ„ ๊ฐœ๋ฐœ์ž ๋Œ€ํšŒ์ž…๋‹ˆ๋‹ค.

  • 3๋…„์งธ๋ฅผ ๋งž์ดํ•˜๋Š” 2020๋…„, ์ฝ”๋กœ๋‚˜19์™€ ๊ธฐํ›„๋ณ€ํ™”์˜ ์†”๋ฃจ์…˜์„ ๋งŒ๋“œ๋Š” โ€˜2020 ์ฝœ ํฌ ์ฝ”๋“œ ํ•œ๊ตญ ํ•ด์ปคํ†คโ€™์— ์ฐธ๊ฐ€ํ•  ๋Šฅ๋ ฅ ์žˆ๋Š” ๊ฐœ๋ฐœ์ž์™€ ๊ธฐํš์ž, ๋””์ž์ด๋„ˆ๋ฅผ ์ฐพ์Šต๋‹ˆ๋‹ค.

  • ํ•จ๊ป˜ ํ”„๋กœ์ ํŠธ๋ฅผ ์ˆ˜ํ–‰ํ•  ํŒ€์›๊ณผ ์ „๋ฌธ๊ฐ€ ๋ฉ˜ํ† ๋ฅผ ๋งŒ๋‚˜๊ณ  ์ฝ”๋กœ๋‚˜19, ๊ธฐํ›„๋ณ€ํ™”์— ๋Œ€ํ•œ ์˜จ๋ผ์ธ ๊ต์œก์„ ํ†ตํ•ด ์‚ฌํšŒ๋ฌธ์ œ ์ „๋ฌธ๊ฐ€, ICT ์ „๋ฌธ๊ฐ€์™€ ์–ด๋–ค ์‚ฌํšŒ๋ฌธ์ œ๋ฅผ ์–ด๋–ป๊ฒŒ ICT๋กœ ํ’€์–ด๋‚˜๊ฐˆ ์ˆ˜ ์žˆ์„์ง€ ํ•จ๊ป˜ ์ด์•ผ๊ธฐ ๋‚˜๋ˆ ๋ด…๋‹ˆ๋‹ค.

  • ๊ทธ๋ฆฌ๊ณ  ์ด๋ฅผ ํ†ตํ•ด ์‚ฌํšŒ๊ฐ€ ํ•„์š”๋กœ ํ•˜๋Š” ์ƒ์šฉํ™” ๊ฐ€๋Šฅํ•œ ์„œ๋น„์Šค๋ฅผ ์ง์ ‘ ๋งŒ๋“ค์–ด๋ณด์„ธ์š”. ๋‹น์‹ ์ด ๋งŒ๋“  ์ฝ”๋“œ๊ฐ€ ์„ธ์ƒ์„ ๊ตฌํ•  ์ˆ˜ ์žˆ๋Š” ํŠน๋ณ„ํ•œ ๊ธฐํšŒ, ์ง€๊ธˆ ๋„์ „ํ•˜์„ธ์š”!

  • Korea Hackathon์€ IBM Korea, ์„œ์šธ์‹œ, ์„œ์šธํ˜์‹ ํŒŒํฌ, ์„œ์šธ์ด๋…ธ๋ฒ ์ด์…˜ํŒน๋žฉ์ด ํ•จ๊ป˜ํ•ฉ๋‹ˆ๋‹ค.

    โ€˜์ฝ”๋กœ๋‚˜19โ€™์— ๋งž์„œ๊ธฐ

    ์˜ˆ์‹œ : ๊ธด๊ธ‰ ์ปค๋ฎค๋‹ˆ์ผ€์ด์…˜ ์‹œ์Šคํ…œ, ์›๊ฒฉ ๊ต์œก ์ง€์›, ์ง€์—ญ ์‚ฌํšŒ ํ˜‘๋ ฅ ๊ตฌ์ถ•, ๊ธฐ๋ถ€๊ธˆ ํ”Œ๋žซํผ ๋“ฑ

    โ€˜๊ธฐํ›„๋ณ€ํ™”โ€™์— ๋งž์„œ๊ธฐ

    ์˜ˆ์‹œ : ์ˆœํ™˜๊ฒฝ์ œ ์ง€์› ํ”Œ๋žซํผ, ์žฌ๋‚œ ๋ณต์›์„ ์œ„ํ•œ ์„œ๋น„์Šค, ์—๋„ˆ์ง€ / ๋ฌผ ์ง€์† ๊ฐ€๋Šฅ์„ฑ ์ง€์› ๋“ฑ

1. ์ „์ฒด ์ผ์ •

StepDateProperty
์ฐธ๊ฐ€ ์‹ ์ฒญ ๋ฐ ์•„์ด๋””์–ด ์ œ์ถœ2020.04.23 ~ 05.13์ฐธ๊ฐ€ ์‹ ์ฒญ 5์ธ ์ดํ•˜์˜ ํŒ€ ๋˜๋Š” ๊ฐœ์ธ ๊ตฌ์„ฑ ๊ฐ„๋‹จํ•œ ์•„์ด๋””์–ด ์ ‘์ˆ˜
ย 2020.05.12์ตœ์ข… ์ฐธ๊ฐ€์ž ๋ฐœํ‘œ * ์ดํ›„ ์„ธ๋ถ€ ์ผ์ • ๋ฐ ์ง„ํ–‰๋ฐฉ์‹ ๊ฐœ๋ณ„ ์•ˆ๋‚ด ์˜ˆ์ •
์˜จ๋ผ์ธ ๊ต์œก ์„ธ์…˜ ๋ฐ ํ•œ๊ตญ ํ•ด์ปคํ†ค ์ง„ํ–‰2020.05.14 ~ 05.293ํšŒ ์˜จ๋ผ์ธ ๊ต์œก ์„ธ์…˜ ๋ฐ ๊ฐœ์ธ ์ฐธ์—ฌ์ž ํŒ€ ๊ตฌ์„ฑ ์ฝ”๋กœ๋‚˜19 / ๊ธฐํ›„๋ณ€ํ™” / Starter Kit ์„ธ์…˜๋ณ„ ์ „๋ฌธ๊ฐ€ ๋ฐœ์ œ ๋ฐ ์งˆ์˜์‘๋‹ต
ย 2020.06.12 ~ 06.13Korea Virtual Hackathon ์ „๋ฌธ๊ฐ€ ๋ฉ˜ํ† ์™€ ํ•จ๊ป˜ ๋ฌด๋ฐ• 2์ผ ํ•ด์ปคํ†ค ์ง„ํ–‰ ์„œ์šธ์‹œ์žฅ์ƒ, ํ•œ๊ตญIBM ์‚ฌ์žฅ์ƒ ํ‘œ์ฐฝ

1818 ํŒ€ ์ผ์ •

1818์ผ์ •

ํšŒ์˜๋‚ ์งœ์ฃผ์ œ
1์ฐจ2020.04.29์ฃผ์ œ์— ๋”ฐ๋ฅธ ๊ฐ์ž ์•„์ด๋””์–ด ๊ตฌ์ƒ ํšŒ์˜
2์ฐจ2020.05.03์•„์ด๋””์–ด 2๊ฐœ์”ฉ ์„ ํƒ ํ›„ ์„ธ๋ถ€ ๊ธฐ์ˆ  ์กฐ์‚ฌ
3์ฐจ2020.05.07์•„์ด๋””์–ด ์„ ํƒ ํšŒ์˜
4์ฐจ2020.05.24์•„์ด๋””์–ด ์žฌ์ •๋น„ ํšŒ์˜
5์ฐจ2020.05.27์•„์ด๋””์–ด ๊ตฌ์ฒดํ™” ํ›„ ์„ธ๋ถ€ ์ผ์ • ์ •๋ฆฌ
6์ฐจ2020.06.01IBM ํด๋ผ์šฐ๋“œ ์„ ์ • ๋ฐ ๊ณต๋ถ€ (Speech to Text)
7์ฐจ2020.06.08์ง„ํ–‰ ์ƒํ™ฉ ๊ณต์œ  ๋ฐ ๊ณตํ†ต ๊ณผ์ œ ํšŒ์˜
8์ฐจ2020.06.09์ง„ํ–‰ ์ƒํ™ฉ ๊ณต์œ  ๋ฐ ๊ณตํ†ต ๊ณผ์ œ ํšŒ์˜
9์ฐจ2020.06.10๊ฐœ์ธ ๊ณต๋ถ€ ๋ฐ”ํƒ•์œผ๋กœ ๊ฒฐ๊ณผ๋ฌผ ์ œ์ž‘(๋ฏธ๋ฆฌ, ํ˜ธ์—ฐ, ์„ธ๊ฒฝ)
10์ฐจ2020.06.11๊ฐœ์ธ ๊ณต๋ถ€ ๋ฐ”ํƒ•์œผ๋กœ ๊ฒฐ๊ณผ๋ฌผ ์ œ์ž‘(์ •์›, ํ˜„์šฐ)
ํŒ€ 1818๋…ธ์…˜ ํšŒ์˜๋กhttps://www.notion.so/ibmhackathonssafy03/7b32393d451f478995235f1015990835

2. ํŒ€ ๊ตฌ์„ฑ

Person์—ญํ• ์„ธ๋ถ€์‚ฌํ•ญ
๊น€ํ˜ธ์—ฐํŒ€์žฅ, ๊ฐœ๋ฐœ๋ชจ๋“  ํŒŒํŠธ ๋ณด์กฐ, ๋ฐฑ์—”๋“œ ๊ฐœ๋ฐœ
๊ณฝ์„ธ๊ฒฝ๋””์ž์ด๋„ˆ, ๊ฐœ๋ฐœ์„œ๋น„์Šค ํ”Œ๋žซํผ ๋””์ž์ธ, ๋ฐฑ์—”๋“œ ๊ฐœ๋ฐœ
๋ฐ•ํ˜„์šฐ๊ฐœ๋ฐœํ”„๋ก ํŠธ, ๋ฐฑ์—”๋“œ ๊ฐœ๋ฐœ
์ตœ๋ฏธ๋ฆฌ๊ธฐํš, ๊ฐœ๋ฐœ๊ธฐํš์•ˆ ์ž‘์„ฑ, ๊ธฐ๋Šฅ ํ…Œ์ŠคํŠธ, ๊ฐœ๋ฐœ ๋ณด์กฐ
์ตœ์ •์›๊ฐœ๋ฐœํ”„๋ก ํŠธ, ๋ฐฑ์—”๋“œ ๊ฐœ๋ฐœ

3. ํ”„๋กœ์ ํŠธ ๊ฐœ์š”

ํŒ€ 1818์˜ ํ”„๋กœ์ ํŠธ ๋ชฉํ‘œ

  • AI ๊ธฐ๋ฐ˜ ๊ณต๊ณต ์ „ํ™” ์—ฐ๊ฒฐ ์„œ๋น„์Šค โ€œ1818โ€

  • Watson์˜ Speech to text, Assistance, Text to speech ์‚ฌ์šฉ
  • 1818 ๋ฒˆ์œผ๋กœ ์ „ํ™” ์—ฐ๊ฒฐ์‹œ, ์‚ฌ์šฉ์ž๊ฐ€ ํ•„์š”๋กœ ํ•˜๋Š” ์„œ๋น„์Šค๋ฅผ ๋ถ„์„ํ•˜์—ฌ ๊ด€๋ จ ์—ฐ๋ฝ์ฒ˜ ๋ฐ ์ •๋ณด๋ฅผ ์ œ๊ณตํ•˜๋Š” ์„œ๋น„์Šค
  • ์ž์—ฐ์–ด ์ฒ˜๋ฆฌ๋ฅผ ํ†ตํ•ด 1์ฐจ๋กœ ์ฆ‰๊ฐ์ ์ธ ์ •๋ณด๋ฅผ ์ œ๊ณตํ•ด์ค€๋‹ค.
  • 1์ฐจ ํ•„ํ„ฐ๋ง์ด ํ•ด๊ฒฐ๋˜์ง€ ์•Š๋Š” ๊ฒฝ์šฐ, ํ•„์š”ํ•œ ์„œ๋น„์Šค์— ๋งž๋Š” ๊ณต๊ณต๊ธฐ๊ด€ ์—ฐ๋ฝ์ฒ˜๋กœ ์—ฐ๊ฒฐํ•ด์ฃผ๋Š” 2์ฐจ ๊ณผ์ •์ด ์ง„ํ–‰๋จ.

  • ์žฌ๋‚œ ์ƒํ™ฉ์—์„œ ์‹ ๊ณ ์™€ ๋ฏผ์›์ด ๊ณผ๋ถ€ํ•˜ ๋˜๋Š” ๊ฒƒ์„ 1์ฐจ์ ์œผ๋กœ ๋ง‰๊ณ , ์ธํ„ฐ๋„ท ์‚ฌ์šฉ์ด ๋ถˆ๊ฐ€ํ•œ ์ƒํ™ฉ์—์„œ๋„ ์‚ฌ์šฉ ๊ฐ€๋Šฅ.
  • ํ‰์†Œ์—๋„ ๊ฐ„๋‹จํ•œ ์ •๋ณด ์ œ๊ณต ์—ญํ• ์„ ํ•˜๋ฉฐ ์ง€์†์ ์œผ๋กœ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•˜๋‹ค.
  • ์ด ์„œ๋น„์Šค๋ฅผ ํ†ตํ•ด ์–ป์€ ๋ฐ์ดํ„ฐ๋“ค๋กœ ์•ž์œผ๋กœ์˜ ์žฌ๋‚œ์„ ์˜ˆ๋ฐฉํ•˜๊ณ  ๋ถ„์„ํ•˜๋Š” ์„œ๋น„์Šค๋กœ ๋ฐœ์ „ํ•  ์ˆ˜ ์žˆ์Œ.

4. ํ”„๋กœ์ ํŠธ ์†Œ๊ฐœ

 ํ๋ฆ„๋„ ๋ฐ ์˜ˆ์‹œ

5. ์ฝ”๋“œ

  1. Watson์˜ STT ์†”๋ฃจ์…˜์„ ํ™œ์šฉํ•˜์—ฌ ์‚ฌ์šฉ์ž์˜ ์Œ์„ฑ์„ ํ…์ŠคํŠธ ์ฒ˜๋ฆฌํ•˜๋Š” ๋ชจ๋“ˆ ๊ฐœ๋ฐœ

    • ์˜ˆ์‹œ ์ฝ”๋“œ
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    
    from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
       
    authenticator = IAMAuthenticator('{apikey}')
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
       
    text_to_speech.set_service_url('{url}')
       
    with open('hello_world.wav', 'wb') as audio_file:
        audio_file.write(
            text_to_speech.synthesize(
                'Hello world',
                voice='en-US_AllisonV3Voice',
                accept='audio/wav'        
            ).get_result().content)
    
    • ์ˆ˜์ • ์ฝ”๋“œ
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import json
from os.path import join, dirname
from ibm_watson import SpeechToTextV1
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator

# authenticator ์ง€์ •
def authenticate(k):
    authenticator = IAMAuthenticator(k)
    return authenticator

def stt(a):
    speech_to_text = SpeechToTextV1(authenticator=a)
    return speech_to_text

# ์–˜๋Š” views.py์—์„œ ๋งŒ๋“ค๊ธฐ
def set_url(stt, api_url):
    stt.set_service_url(api_url)
    return stt

โ€‹

  1. STT์˜ ๊ฒฐ๊ณผ๋ฅผ ํ†ตํ•ด ์›ํ•˜๋Š” ํ‚ค์›Œ๋“œ ๊ฐ’์„ ์ถ”์ถœํ•˜๋Š” ๋ชจ๋“ˆ ๊ฐœ๋ฐœ

    • ์˜ˆ์‹œ ์ฝ”๋“œ
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    
    import json
    from os.path import join, dirname
    from ibm_watson import SpeechToTextV1
    from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
       
    authenticator = IAMAuthenticator('{apikey}')
    speech_to_text = SpeechToTextV1(
        authenticator=authenticator
    )
       
    speech_to_text.set_service_url('{url}')
       
    with open(join(dirname(__file__), './.', 'audio-file2.flac'),
                   'rb') as audio_file:
        speech_recognition_results = speech_to_text.recognize(
            audio=audio_file,
            content_type='audio/flac',
            word_alternatives_threshold=0.9,
            keywords=['colorado', 'tornado', 'tornadoes'],
            keywords_threshold=0.5
        ).get_result()
    print(json.dumps(speech_recognition_results, indent=2))
    
    • ์ˆ˜์ • ์ฝ”๋“œ
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    
    # open ํ•จ์ˆ˜ํ™”
    def start_stt(stt, filename):
        with open(join(dirname(__file__), '../media/timeline_audio', filename), 'rb') as audio_file:
            speech_recognition_results = stt.recognize(
            audio=audio_file,
            content_type='audio/wav',
            model='en-US_ShortForm_NarrowbandModel',
            word_alternatives_threshold=0.9,
           
            keywords=['\ub54c\ubb38\uc5d0', '\uc790\uafb8'],
            keywords_threshold=0.5
        ).get_result()
        return speech_recognition_results
       
       
    def get_keyword(srr):
        keyword = dict(srr, indent=2)["results"][0]["alternatives"][0]["transcript"]
        return keyword
    
  2. ์ถ”์ถœ๋œ ํ‚ค์›Œ๋“œ ๋ฐ์ดํ„ฐ๋ฅผ Watson์˜ assistant ์†”๋ฃจ์…˜์„ ํ™œ์šฉํ•ด ์•Œ๋งž์€ ๋ฐ์ดํ„ฐ๋ฅผ ์—ฐ๊ฒฐํ•˜๋Š” ๋ชจ๋“ˆ ๊ฐœ๋ฐœ

    • ์˜ˆ์‹œ ์ฝ”๋“œ
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    
    import json
    from ibm_watson import AssistantV2
    from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
       
    authenticator = IAMAuthenticator('{apikey}')
    assistant = AssistantV2(
        version='2020-04-01',
        authenticator = authenticator
    )
       
    assistant.set_service_url('{url}')
       
    response = assistant.message_stateless(
        assistant_id='{assistant_id}',
        input={
            'message_type': 'text',
            'text': 'Hello'
        }
    ).get_result()
       
    print(json.dumps(response, indent=2))
    
    • ์ˆ˜์ • ์ฝ”๋“œ
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    
    import json
    from ibm_watson import AssistantV2
    from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
       
    def authenticate(api_key):
        authenticator = IAMAuthenticator(api_key)
        return authenticator
       
    def set_assistant(authenticator):
        assistant = AssistantV2(
            version='2020-04-01',
            authenticator= authenticator
        )
        return assistant
       
    def set_url(assistant, api_url):
        assistant.set_service_url(api_url)
        return assistant
       
    def get_response(assistant, a_id, text):
        response = assistant.message_stateless(
            assistant_id= a_id,
            input={
                'message_type': 'text',
                'text': text
            }
        ).get_result()
        texts = response['output']['generic'][0]['text']
        return texts
    
  3. Watson์˜ TTS์†”๋ฃจ์…˜์„ ํ™œ์šฉํ•˜์—ฌ ์—ฐ๊ฒฐ๋œ ๋ฐ์ดํ„ฐ๋ฅผ ๋‹ค์‹œ ์Œ์„ฑ์œผ๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ๋ชจ๋“ˆ ๊ฐœ๋ฐœ

    • ์ฝ”๋“œ
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    
    from os.path import join, dirname
    from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
       
    def authenticate(k):
        authenticator = IAMAuthenticator(k)
        return authenticator
       
    def tts(a):
        speech_to_text = TextToSpeechV1(authenticator=a)
        return speech_to_text
       
    def set_url(tts, api_url):
        tts.set_service_url(api_url)
        return tts
       
    def start_tts(tts, filename, text):
        with open(join(dirname(__file__), '../media/timeline_audio', filename), 'wb') as audio_file:
            audio_file.write(
                tts.synthesize(
                    text,
                    voice='en-US_MichaelV3Voice',
                    accept='audio/wav'        
                ).get_result().content)
               
    
  4. ์‚ฌ์šฉ์ž๊ฐ€ ์„œ๋น„์Šค๋ฅผ ์ด์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก Django๋ฅผ ํ™œ์šฉํ•˜์—ฌ ์›น์œผ๋กœ ๊ตฌํ˜„

This post is licensed under CC BY 4.0 by the author.

-

[My project] ์ทจํ–ฅ์˜ ๋‚˜๋ˆ”

Loading comments from Disqus ...