ä»æ¥ãã¹ããŒããã©ã³ãã¹ããŒããŠã©ããããã£ãããã¹ãã©ãã«ãŒã¯ããããšããã«ãããŸãããããã¯ãç§ãã¡èªèº«ãç§ãã¡ã®åšå²ãç£èŠããã®ã«åœ¹ç«ã¡ãéç¥ãéä¿¡ããå¿æ¿çŽ°åãªã©ã®æ·±å»ãªåé¡ãæ€åºããããšããã§ããŸãããããŠãç§ãã¡ã¯ãã€ã¯ãã¢ãã¿ãªã³ã°éåã®å§ãŸãã«éããŸããã
ãã®èšäºã§ã¯ãç¬ã®æ°åæ€åºåšã®ã¢ã€ãã¢ãèŠãŠãããŸããåšå²ã®é³ãèãããã€ã¹ãäœæããç¬ãããå Žåã¯ãç¬ãã©ã®ãããªé³ãåºããŠããããå€æããããšããŸããå奜çãªå ã声ããã³ããæ³£ã声ãæ»æçãªåžã声ãªã©ã§ãããŠãŒã¶ãŒã®å¥œã¿ã«å¿ããŠãç¬ããã§ãã¯ããå¿ èŠããããšå€æãããšãã«ããã€ã¹ãæ¯åããŸããããã¯ã飌ãäž»ãç¬ã®è³ãèãããªããªã£ããšãã«ç¬ã远跡ããã®ã«åœ¹ç«ã€å¯èœæ§ããããŸãããã¡ãããããã¯åãªããããã¿ã€ãã§ããããã®ã¢ã€ãã¢ã®çµæã¯ãŸã å®éã®æ¡ä»¶ã§ãã¹ããããŠããŸããã
ArmããŒã¹ã®RaspberryPiã³ã³ãã¥ãŒã¿ãŒã䜿çšããŠããã®ããã€ã¹ã®ãããã¿ã€ããäœæããŸããããã¯ããšã³ããŠãŒã¶ãŒããã€ã¹ã«æ©æ¢°åŠç¿ãå®è£ ããããã®åªãããã©ãããã©ãŒã ã§ãã Armããã»ããµã¯ãRaspberry Piã§äœ¿çšãããã ãã§ãªããå€ãã®æºåž¯é»è©±ãã¢ãã€ã«ã²ãŒã ã³ã³ãœãŒã«ãããã³ãã®ä»ã®å€ãã®ããã€ã¹ã§ãåäœããŸãããããã®ã³ã³ãã¥ãŒã¿ãŒã®ãšãã«ã®ãŒå¹çã®é«ãããã»ããµãŒã¯ååãªåŠçèœåãåããŠãããã©ãã§ãæé ãªäŸ¡æ Œã§è³Œå ¥ã§ããŸãã
æ®å¿µãªããããããŸã§ã®ãšãããå°åããã€ã¹ã®æ©èœã¯ãåŠçèœåãã€ã³ã¿ãŒãããæ¥ç¶ã®æ¬ åŠãããã³ååãšããŠå°éã®ããŒã¿ã¹ãã¬ãŒãžã«ãã£ãŠå¶éãããããšããããããŸãããã®ãããªããã€ã¹ã¯çæéã§å€ãã®èŠ³æž¬ãå®äºããããšãã§ããŸãããã¹ãã¬ãŒãžã®å¶éã®ããã«ã€ã³ã¿ãŒãããæ¥ç¶ããªãå ŽåãåŸã§åæããããã«ãã¹ãŠã®èŠ³æž¬ãä¿åããããšã¯ãã°ãã°äžå¯èœã§ããããã«ã倧éã®ããŒã¿ãã¯ã€ã€ã¬ã¹ã§éä¿¡ãããšããã§ã«å°éã®ããããªãŒé»åãæ¶è²»ããŸãã
èšé²ãããä¿¡å·ãæ倧éã«æŽ»çšããã«ã¯ãä¿¡å·åŠçã¹ããŒãžããšã³ããŠãŒã¶ãŒã®ããã€ã¹èªäœã«ç§»åããããšãäžå¯æ¬ ã§ãã
éå»10幎éã æ©æ¢°åŠç¿ç»åå ã®ãªããžã§ã¯ãæ€åºããããªãžã§ã¹ãã£èªèãé³å£°èªèãªã©ãå€ãã®ä¿¡å·åŠçã¿ã¹ã¯ã®ç²ŸåºŠãå€§å¹ ã«åäžããŸãããä»æ¥ãç§ãã¡ã¯å¯èœæ§ã®è¡šé¢ãåŒã£æ»ããŠããã ãã§ããå°ããªããã€ã¹ã§MLã䜿çšãããšã人ã ã®ç掻ãæ¹åããä»ã®ç¡æ°ã®æ¹æ³ãæäŸãããŸãã
éå§
ãã¬ãŒãã³ã°çšã®GoogleAudioSetãèŠãŠã¿ãŸããã ãããã¯ãYouTubeãããªããã®10ç§ã®ãªãŒãã£ãªã¯ãªããã®æ倧ã®ã³ã¬ã¯ã·ã§ã³ã§ããããŒã¿ã¯ãYouTube-8Mã¹ã¿ãŒã¿ãŒããããšäºææ§ã®ããååŠçããã圢åŒã§æäŸãã ãŸãããªãŒãã£ãªã¯ãªãããåé¡ã§ããã¢ãã«ããã¬ãŒãã³ã°ããããã«äœ¿çšãããŸãã
ãã®ã¢ãã«ã®ãã¬ãŒãã³ã°ã«ã¯æéããããå ŽåããããããåŠçãGoogle CloudAIãã©ãããã©ãŒã ã«ç§»è¡ã ãŸããå®äºããããã¢ãã«ãããŒãããŸãããã¹ãŠã®ã³ã³ããŒãã³ãã®æºåãã§ããããã¢ãã«ãRaspberryPiã«è»¢éããŸãããŸããæ¥ç¶ããããã€ã¯ããã®å ¥åããã£ããã£ããèå¥ãããç¬ã®é³ã1ç§ããã«äºæž¬ããPythonã¹ã¯ãªãããäœæããŸãã
ç®çã®ã¢ãã«ãäœæãã
ãŸããããããè¡ããã¹ãŠã®äœæ¥çšã®ãã©ã«ããŒãã©ããã«äœæããŸãããã
ã¢ãã«ãäœæããã«ã¯ãããŒã¿ã»ãããããŒãããå¿ èŠããããŸã ãããã¯ããæ©èœããŒã¿ã»ããããšããèŠåºãã®äžã®ãªã³ã¯ããå ¥æã§ããŸããæãç°¡åãªæ¹æ³ã¯ã1ã€ã®gzipã¢ãŒã«ã€ãã¢ãŒã«ã€ããããŒã«ã«ã³ã³ãã¥ãŒã¿ãŒã«ããŠã³ããŒãããããšã§ãã
次ã«ãããã解åããŠãã¡ã€ã«ãæœåºããŸãããã®ããã±ãŒãžã«ã¯3ã€ã®ãã©ã«ããŒããããŸãã1ã€ã¯ãã©ã³ã¹ã®åãããã¬ãŒãã³ã°ã»ããããã1ã€ã¯è©äŸ¡ã»ããã3ã€ç®ã¯ã¢ã³ãã©ã³ã¹ã®ãã¬ãŒãã³ã°ã»ããã§ããåãã©ã«ãã«ã¯4000ãè¶ ãããã¡ã€ã«ãå«ãŸããŠããŸãã
TFRecordãã¡ã€ã«ã«ã¯ãååŠçãããã¿ã°ãå«ãŸããŠããŸãããã¡ã€ã«åã¯ãYouTubeãããªIDã®æåã®2æåã§å§ãŸããŸãããããªIDã§ã¯å€§æåãšå°æåãåºå¥ããããããWindowsã®ããã«ããŒã«ã«ãã¡ã€ã«ã·ã¹ãã ã§å€§æåãšå°æåãåºå¥ãããªãå Žåã¯ããã¡ã€ã«ãæœåºãããšãã«æ³šæããå¿ èŠããããŸãã
圹ç«ã€ã¢ããã€ã¹ïŒ 7zipããã°ã©ã ã¯ããã®ãããªç¹æ§ãã¡ã€ã«ãæœåºããããã«äœ¿çšãããŸãã 7zipã¯ã³ãã³ãã©ã€ã³ãªãã·ã§ã³ããµããŒãããŠããŸããããã«ãããæ¢åã®ãã¡ã€ã«ã®ååãèªåçã«å€æŽããŠããã¡ã€ã«ãäžæžããããã®ã§ã¯ãªãååãå€æŽãããããã«ããããšãã§ããŸãã
æ£ããæœåºãããããŒã¿ã»ãããåãåã£ãããYouTube-8MGithubãªããžããªã®ã¯ããŒã³ãäœæ ããŸãããã«ã¯ãã¢ãã«ããã¬ãŒãã³ã°ããããã®ã³ãŒããå«ãŸããŠããŸããæœåºãããããŒã¿ã»ããçšã«äœæããããã©ã«ããŒã«ã¯ããŒã³ãäœæããããšããå§ãããŸãã
ãããŠãæŽæ°readers.pyãã¡ã€ã« ã®å€ãAudioSet TFRecordãã¡ã€ã«ããµããŒãããããã«ãYouTubeã®-8Mãã©ã«ãå ãããã®ããã»ã¹ã«ã¯ã次ã®2ã€ã®æ®µéããããŸãã
- ãidãã®ãã¹ãŠã®åºçŸç®æããvideo_idãã«å€æŽããŸãã
- num_classesãã©ã¡ãŒã¿ãŒã®ããã©ã«ãå€ã527ã«å€æŽããŸãããã®æ°å€ã¯ããã®ãªãŒãã£ãªããŒã¿ã»ããå
ã®ããŸããŸãªã«ããŽãªã®æ°ã«å¯Ÿå¿ããŸãã
èå¥åã¯5ç®æã§å€æŽããnum_classesã¯2ç®æã§å€æŽããå¿ èŠããããŸãã
ãã®ããã°ã©ã ãå®è¡ããã«ã¯ãæ°ããPython 3.6以éã®ä»®æ³ç°å¢ããããã€ããtensorflow == 1.14ãã€ã³ã¹ããŒã«ããŸãããŸã ã次ã®ã¹ãããã§äœæããåºåã¹ã¯ãªããã®èŠä»¶ãèšå®ãããšäŸ¿å© ã§ããããŒãžã§ã³çªå·ã¯ããã±ãŒãžããšã«ç°ãªããŸãããå¯äžã®é£ããèŠä»¶ã¯ãtensorflowããŒãžã§ã³1.14ã䜿çšããããšã§ãããã®ä»ã®ããã±ãŒãžã«ã€ããŠã¯ãææ°ããŒãžã§ã³ãã€ã³ã¹ããŒã«ããã ãã§ãã
ãã®æç¹ã§ãã¢ãã«ããã¬ãŒãã³ã°ããæºåãæŽããŸããããŸãããã¬ãŒãã³ã°ã¹ã¯ãªãããããŒã«ã«ã§å®è¡ããŠãã¹ãããŸãããã©ã³ã¹ã®åãããã¬ãŒãã³ã°ã»ããã§ã¯ãããã»ã©æéã¯ããããŸãããã³ãã³ãããã³ãããŠã£ã³ããŠãéãããã®ã»ã¯ã·ã§ã³ã®æåã®æé ã§äœæãããã©ã«ããŒã«ç§»åããŠã次ã®ã³ãã³ããå ¥åããŸãïŒããã¯ãã¹ãŠ1è¡ã§ããããšã«æ³šæããŠãã ããïŒã
python youtube-8m/train.py \ --train_data_pattern=./audioset_v1_embeddings/bal_train/*.tfrecord \
--num_epochs=100 \
--feature_names="audio_embedding" \
--feature_sizes="128" \
--frame_features \
--batch_size=512 \
--train_dir ./trained_models/yt8m \
--model=FrameLevelLogisticModel \
--start_new_model
ãŸããæ¹è¡æå\ã¯Linuxã·ã¹ãã ã§ã¯æ£åžžã«æ©èœããŸãããWindowsã§ã¯^æåã«çœ®ãæããå¿ èŠãããããšã«ã泚æããŠãã ããã
100ãšããã¯ã®åŸãããã¯çŽã¹ããã8500ã«éãããŸã§ç¶ããŸããFrameLevelLogisticModelã¯çŽ58ã59ïŒ ã®æ倧粟床ã§åäœããŸããç§ãã¡ã®ãã¹ãã·ã¹ãã ã§ã¯ãããã»ã¹å šäœã«20å匱ããããŸããã
ãã®ã¹ã¿ãŒã¿ãŒãããã«ã¯ãDbofModelãLstmModelãªã©ã®ä»ã®ã¢ãã«ãå«ãŸããŠããŸãããããã¯ããããããã¬ãŒãã³ã°ããŒã¿ã«å¯ŸããŠã»ãŒå®å šãªç²ŸåºŠãæäŸããŸãããã¹ã³ã¢ã»ããã§ãã¹ããããšããã©ã³ã¹ã®åãããã¬ãŒãã³ã°ã»ããã§ã¯äž¡æ¹ãšãå€§å¹ ã«éå°é©åããŸãã
ã¯ã©ãŠãã§ã¢ãã«ããã¬ãŒãã³ã°ãã
å¥ã®æ¹æ³ã¯ãäžåè¡¡ãªããŒã¿ã»ããã䜿çšããŠãµãŠã³ãã®ãã«ã»ããããã¬ãŒãã³ã°ããããšã§ãããã®å ŽåãåŠçã«ã¯ã¯ããã«æéãããããŸãããGoogle CloudAIãã©ãããã©ãŒã ã«åºã¥ãGPUãéåžžã«åœ¹ç«ã¡ãŸããåçŽãªããžã¹ãã£ãã¯ã¢ãã«ã¯ãäžåè¡¡ãªãã¬ãŒãã³ã°ã»ããã§çŽ88ïŒ ã®ç²ŸåºŠãéæããŸãã
ã¯ã©ãŠãã§ãã®ããã»ã¹ãå®è¡ããã«ã¯ãGoogle Cloud AIãã©ãããã©ãŒã ã¢ã«ãŠã³ãã«ãµã€ã³ã¢ããããŠãã°ã€ã³ãã課éãæå¹ã«ããŠãããã§è©³ãã説æãããŠããã³ãã³ãã©ã€ã³ããŒã«ãããŠã³ããŒãã ãŸãã
ãã¹ãŠã®èšå®ãå®äºãããã ã¯ã©ãŠãã³ã³ãœãŒã«ã«ç§»åããŸããæ°ãããããžã§ã¯ããšæ°ããã¹ãã¬ãŒãžãã¹ã±ãããäœæããŸããã¹ãã¬ãŒãžãã±ããåã¯ã°ããŒãã«ã«äžæã§ããå¿ èŠããããŸãããŠãŒã¶ãŒã¢ã«ãŠã³ãã®ååãå«ãŸããŠãããšæãç°¡åã§ãã audioset_v1_embeddingsãã©ã«ããŒãšyoutube-8mãã©ã«ããŒå šäœããã®ã¹ãã¬ãŒãžãã¹ã±ããã«ããŒãããŸãã
æ£ããå®è¡ãããã°ãGoogle Cloud SDKã·ã§ã«ãéãã以äžã®ã³ãã³ããå®è¡ããŠéå§ã§ããã¯ãã§ãã your-project-nameãšyour-storage-bucket-nameãé©åãªã¢ã«ãŠã³ãå€ã«çœ®ãæããŠãã ãããããã¯UnixããŒã¹ã®ã·ã¹ãã çšã«æžãããŠããŸãã Windowsã·ã¹ãã ã«é©åãªä¿®æ£ãå ããŸãã
BUCKET_NAME=gs://${USER}_yt8m_train_bucket
gsutil mb -p your-project-name $BUCKET_NAME
JOB_NAME=yt8m_train_$(date +%Y%m%d_%H%M%S)
gcloud --verbosity=debug ml-engine jobs submit training $JOB_NAME
--python-version 3.5 --package-path=youtube-8m --module-name=youtube-8m.train --staging-bucket=$BUCKET_NAME --region=us-east1 --config=youtube-8m/cloudml-gpu.yaml -- --train_data_pattern='gs://your-storage-bucket-name/audioset_v1_embeddings/unbal_train/*.tfrecord' --model=FrameLevelLogisticModel --train_dir=$BUCKET_NAME/yt8m_train_frame_level_logistic_model
ç¹°ãè¿ãã«ãªããŸãããgcloudã®æåŸã®åŒã³åºãã¯ãæ§æãªãã·ã§ã³ãå«ã1ã€ã®é·ãã³ãã³ãã§ããããšã«æ³šæããŠãã ããã
å®äºãããŸã§ã«åæ¥ä»¥äžããããŸãããã¹ãŠãå®äºããããã¯ã©ãŠãã¹ãã¬ãŒãžãã±ããããã¢ãã«åºåãããŒãããŸãã
$BUCKET_NAME/yt8m_train_frame_level_logistic_model
RaspberryPiã§ã®å®è¡
ãã®ã¢ããªã±ãŒã·ã§ã³ã¯ãPython3ãã€ã³ã¹ããŒã«ãããRaspbianOSãå®è¡ããŠããArmããŒã¹ã®RaspberryPi4ã³ã³ãã¥ãŒã¿ãŒã§ãã¢ã³ã¹ãã¬ãŒã·ã§ã³ããŠããŸãããã®ããã€ã¹ã«PyAudioãã€ã³ã¹ããŒã«ããŸããåé¡ãçºçããå Žåã¯ã ãã®åçã圹ç«ã€ã¯ãã§ãã
USBãã€ã¯ãæ¥ç¶ããŸãïŒãã¹ãçšã®ãªãŒãã£ãªåºåçšã®ãªãã·ã§ã³ã®ãããã»ããä»ãïŒããã®æç¹ã§ããã€ã¯ãããã©ã«ãã®ããã€ã¹ãšããŠæ§æããã®ãæãç°¡åã§ãã Raspianãã¹ã¯ãããã«ç§»åããå³äžé ã®æèšã®æšªã«ããã¹ããŒã«ãŒã¢ã€ã³ã³ãã¯ãªãã¯ããŠã䜿çšãããã€ã¯ãéžæããŸãã
æåŸã®éèŠãªã¹ãããã¯ãAudioSetãšåã128Då§çž®ã§çã®ãªãŒãã£ãªãåŠçãã楜åšãå ¥æããããšã§ããããã«äœ¿çšãããããŒã«ã¯ã«å«ãŸããŠããŸã åè¿°ã®Tensorflowã¢ãã«ã®Githubãªããžããªã Piã§ãŸã£ããåãã€ã³ã¹ããŒã«æé ã«åŸããPython 3ã€ã³ã¹ã¿ã³ã¹ã«ã€ã³ã¹ããŒã«ããããšãå¿ããªãã§ãã ããããŸãããã®ãªããžããªããYouTube-8MããŒã¿ã»ãããšãªããžããªãè€è£œããã®ãšåããã©ã«ãã«è€è£œããŸãã
vggish_smoke_test.pyã¹ã¯ãªãããå®è¡ããŠããã¹ãŠãæ£ããã€ã³ã¹ããŒã«ãããŠããããšã確èªããŸãã
次ã«ãGoogle Cloudãã©ãããã©ãŒã ããããŠã³ããŒãããã¢ãã«ãããã€ã¯ãªã¹ãã³ã°ã¹ã¯ãªããã䜿çšããŠãã©ã«ããŒã«ã³ããŒã ãŸãã
ãã®ã¹ã¯ãªãããå®è¡ããŸããããã©ã«ãã®ããã€ã¹ã§ãªãã¹ã³ãéå§ããäºæž¬ãã³ã³ãœãŒã«ã«æžã蟌ã¿ãŸãã
ç®çã®ããã€ã¹ãããã©ã«ãã®ããã€ã¹ãšããŠæ§æã§ããªãå Žåã¯ãã³ãã³ããpython model-run.py listããå®è¡ããŠããã¹ãŠã®ããã€ã¹ã®ãªã¹ããã€ã³ããã¯ã¹å¥ã«è¡šç€ºããŸããããã€ã¹ã€ã³ããã¯ã¹ãèŠã€ããŠããã®ã€ã³ããã¯ã¹ã䜿çšããŠã³ãã³ããåå®è¡ããŸããäŸãã°ïŒ
python model-run.py 3
ãã®ãã©ã«ããŒã®å å®¹å šäœãRaspberryPiã«ã³ããŒããã³ãŒãã䜿çšããŠã¹ã¯ãªãããå床å®è¡ããŸãã1ç§ã«1åãç¬ãçºããŠãããšããã€ã¹ãèãããã€ãºã®éãäºæž¬ããå¿ èŠããããŸããæ€éãã§ãŒãºã¯ãããã€ã¹ãšã¿ãŒã²ãããŠãŒã¶ãŒã«æãé©ããã¡ã«ããºã ã«çœ®ãæããããšãã§ããŸãã
çµè«
ä»æ¥ã¯ãArmããŒã¹ã®ã¢ãã€ã«ããã€ã¹ã§ãµããŒããããŠãããµãŠã³ãããŒã¹ã®æ©æ¢°åŠç¿ã®1ã€ã®å¯èœãªã¢ããªã±ãŒã·ã§ã³ãæ€èšããŸããããã®æŠå¿µã¯ãåžå Žã«åºãåã«ããã«è©³çŽ°ã«ãã¹ãããå¿ èŠããããŸãããã¢ãã€ã«ããã€ã¹ã§ä»»æã®ãªãŒãã£ãªæ€åºã¢ãã«ãå®è¡ããæ©èœã¯ãã§ã«ååšããŸãã
AudioSetããŒã¿ã«ã¯ãéœåžã®é³ã®å ç¢ãªãªã³ãããžãŒãåãã527åã®ã¿ã°ãå«ãŸããŠããŸããã«ã¯ãã«ããŒãã£ãŒã¢ã«ãŽãªãºã ãé©çšããããåé³æºãvggishãã£ã«ã¿ãŒã«éããããããªã©ãäºæž¬åã«æž¡ãåã«ãµãŠã³ãåŠçãæ¹åããå¯èœæ§ããã ãŸãã
Armãã€ã¯ãããã»ããµãæèŒããRaspberryPiã§ç¬ã®æ°åæ€åºåšãå®è¡ããããšã¯éåžžã«ãšããµã€ãã£ã³ã°ã§ãããããããã«é¢çœãããããã«ãTensorFlowããã±ãŒãžã®ããŒã«ã䜿çšããŠã¢ãã«ãå€æããã³ããžã¿ã«åããTensorFlowLiteãã€ã¯ãã³ã³ãããŒã©ãŒããã±ãŒãžã䜿çšããŠäœã³ã¹ãã§äœé»åã®Armãã€ã¯ãã³ã³ãããŒã©ãŒã§å®è¡ã§ããŸã ã
èå³æ·±ãã§ããïŒãã®ã¢ãããŒãã§è§£æ±ºã§ããåé¡ãå®éšããŠèŠã€ããŠãã ãããããªãã¯ããªãã誰ãã®äººçã«ã©ãã ã圱é¿ãäžããããšãã§ãããã決ããŠç¥ããŸããããããŠãæ©æ¢°åŠç¿ãå³æã§ä»ã«äœãã§ããããç¥ãããã«ãåŠã³ã«æ¥ãŠãã ããïŒãã¡ãããHABRããã¢ãŒã·ã§ã³ã³ãŒããå¿ããªãã§ãã ããïŒã
ãã®ä»ã®è·æ¥ãã³ãŒã¹
è·æ¥
ã³ãŒã¹
- Javaéçºè ã®è·æ¥
- JAVAQAãšã³ãžãã¢
- ããã³ããšã³ãéçºè ã®è·æ¥
- è·æ¥å«ççããã«ãŒ
- C ++éçºè ã®è·æ¥
- è·æ¥Unityã²ãŒã éçºè
- è·æ¥Webéçºè
- ãŒãããã®iOSéçºè ã®è·æ¥
- ãŒãããã®Androidéçºè ã®è·æ¥
ã³ãŒã¹
- æ©æ¢°åŠç¿ã³ãŒã¹
- « Machine Learning Data Science»
- «Machine Learning Deep Learning»
- Data Engineering
- «Python -»
- « »
- DevOps