Slide 1

Slide 1 text

1 ۀ຿վળͷ໘ന͞ ຖ೔ߋ৽͞ΕΔϏδϡΞϧίϯςϯπͷࠩ෼Λ Θ͔Γ΍͘͢͢ΔͨΊͷϓϩτλΠϓΛ࡞Δ·Ͱ ೔ຊܦࡁ৽ฉࣾɹத઒ ສᣦಸ PyCon JP 2022 2022/10/14

Slide 2

Slide 2 text

2 Marina Nakagawa ೔ຊܦࡁ৽ฉࣾͷΤϯδχΞ ೔ܦϏδϡΞϧσʔλͷίϯςϯπ੍࡞
 ΠϯϑϥपΓͷվળͳͲͳͲ ࣗಈԽ͕޷͖Ͱ͢ʂ

Slide 3

Slide 3 text

3 ຊ೔࿩͢͜ͱ ఆظతʹߋ৽͞ΕΔίϯςϯπͷ՝୊ ೔ܦϏδϡΞϧσʔλͱ͸ 1 2 3 ࠩ෼ݕ஌ͷϓϩτλΠϓΛ࡞Δ ݁Ռͱ·ͱΊ 4

Slide 4

Slide 4 text

4 ೔ܦϏδϡΞϧσʔλͱ͸ 1

Slide 5

Slide 5 text

5

Slide 6

Slide 6 text

6 จষ ਤઆ σʔλ Πϥετ ࣸਅ ͋ΒΏΔදݱΛۦ࢖ͯ͠ etc… χϡʔεΛΘ͔Γ΍͘͢఻͑Δ

Slide 7

Slide 7 text

7 https://vdata.nikkei.com/newsgraphics/sanin2022-analysis/

Slide 8

Slide 8 text

8 https://vdata.nikkei.com/newsgraphics/party-poll-votes-map/

Slide 9

Slide 9 text

9 https://vdata.nikkei.com/newsgraphics/coronavirus-world-map/

Slide 10

Slide 10 text

10 https://vdata.nikkei.com/newsgraphics/clear-accounting/clear-accounting/

Slide 11

Slide 11 text

11 https://vdata.nikkei.com/

Slide 12

Slide 12 text

12 ɾ௚ײతʹΘ͔Γ΍͘͢ɺ୹࣌ؒͰಡΊΔίϯςϯπ ɾैདྷͷใಓදݱΛਐԽͤ͞ΔࢼΈ ɾϢʔβʔʹͱͬͯ໾ཱͭίϯςϯπ ɾଉͷ௕͍ίϯςϯπ ɾطଘͷํ๏Ҏ֎ͷίϯςϯπͷྲྀ௨ํ๏ͱϊ΢ϋ΢ ͦΕΒΛ࡞Δ৔͕ ೔ܦϏδϡΞϧσʔλ

Slide 13

Slide 13 text

13 هऀ
 ఻͑Δ΂͖͜ͱ σβΠφʔ ఻͑ํ ΤϯδχΞ 
 ఻͑ΔͨΊͷ࢓૊Έ

Slide 14

Slide 14 text

14 هऀ
 ఻͑Δ΂͖͜ͱ σβΠφʔ ఻͑ํ ΤϯδχΞ 
 ఻͑ΔͨΊͷ࢓૊Έ

Slide 15

Slide 15 text

15 هऀ
 هࣄίϯςϯπͷ಺༰ɾσʔλ σβΠφʔ ίϯςϯπͷઃܭɾσβΠϯ ΤϯδχΞ 
 ഑৴ͷ࢓૊Έ
 Ϣʔβʔ͔ΒͷΠϯλϥΫγϣϯΛؚΉ࡞Γ

Slide 16

Slide 16 text

16 هऀ
 σβΠφʔ ΤϯδχΞ

Slide 17

Slide 17 text

17 ఆظతʹߋ৽͞ΕΔίϯςϯπͷ՝୊ 2

Slide 18

Slide 18 text

18 ఆظతʹߋ৽͞ΕΔίϯςϯπͷ جຊతͳ੍࡞ͷྲྀΕ

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

هऀνʔϜ εϓϨουγʔτͰ ຖ೔σʔλूܭˍνΣοΫ هऀνʔϜͷ੹೚ऀ͕ެ։Λ൑அ $*Λ༻͍ͨσϓϩΠϑϩʔͱ͸ ҟͳΔϑϩʔͰຊ൪ʹ൓ө

Slide 21

Slide 21 text

هऀνʔϜ εϓϨουγʔτͰ ຖ೔σʔλूܭˍνΣοΫ هऀνʔϜͷ ੹೚ऀ͕ެ։Λ൑அ هऀ͕੹೚Λ࣋ͭσʔλ͸ جຊతʹຖ೔ߋ৽͞ΕΔ

Slide 22

Slide 22 text

σβΠφʔɾΤϯδχΞνʔϜ վम͕͋Δ৔߹ (JU)VCͰϦιʔε؅ཧ $*ͰϦϦʔε

Slide 23

Slide 23 text

σβΠφʔɾΤϯδχΞνʔϜ վम͕͋Δ৔߹ (JU)VCͰϦιʔε؅ཧ $*ͰϦϦʔε ࣌ظʹΑͬͯݟͤΔσʔλ΍ ݟͤํΛมߋ͢Δͱ͖ʹߋ৽

Slide 24

Slide 24 text

هऀνʔϜ σβΠφʔɾΤϯδχΞνʔϜ εϓϨουγʔτͰ ຖ೔σʔλूܭˍνΣοΫ վम͕͋Δ৔߹ (JU)VCͰϦιʔε؅ཧ $*ͰϦϦʔε هऀνʔϜͷσʔλͱ σβΠφʔɾΤϯδχΞνʔϜͷ੒Ռ෺͕ ߹Θ͞Δͷ͸ຊ൪؀ڥ ˞΋ͪΖΜ։ൃ؀ڥ΋ଘࡏ͢Δ

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

26

Slide 27

Slide 27 text

ࠓ೔ͷάϥϑ͸ ߋ৽͞Ε͍ͯΔʁ هࣄίϯςϯπͷ ਺ࣈ͸ਖ਼͘͠ දࣔ͞Ε͍ͯΔʁ άϧʔϓԽ͞Εͨ ԣάϥϑ͸େৎ෉ʁ େ෯վमͨ͠ͱ͜Ζ͸ ͖ͪΜͱදࣔ͞Ε͍ͯΔʁ ೔෇͸ ߋ৽͞Ε͍ͯΔʁ

Slide 28

Slide 28 text

ࠓ೔ͷάϥϑ͸ ߋ৽͞Ε͍ͯΔʁ هࣄίϯςϯπͷ ਺ࣈ͸ਖ਼͘͠ දࣔ͞Ε͍ͯΔʁ άϧʔϓԽ͞Εͨ ԣάϥϑ͸େৎ෉ʁ େ෯վमͨ͠ͱ͜Ζ͸ ͖ͪΜͱදࣔ͞Ε͍ͯΔʁ ຖ೔ߋ৽͞ΕΔ σʔλܥ ೔෇͸ ߋ৽͞Ε͍ͯΔʁ

Slide 29

Slide 29 text

ࠓ೔ͷάϥϑ͸ ߋ৽͞Ε͍ͯΔʁ هࣄίϯςϯπͷ ਺ࣈ͸ਖ਼͘͠ දࣔ͞Ε͍ͯΔʁ άϧʔϓԽ͞Εͨ ԣάϥϑ͸େৎ෉ʁ େ෯վमͨ͠ͱ͜Ζ͸ ͖ͪΜͱදࣔ͞Ε͍ͯΔʁ վम࣌ʹ ߋ৽͞ΕΔܥ

Slide 30

Slide 30 text

ࠓ೔ͷάϥϑ͸ ߋ৽͞Ε͍ͯΔʁ هࣄίϯςϯπͷ ਺ࣈ͸ਖ਼͘͠ දࣔ͞Ε͍ͯΔʁ άϧʔϓԽ͞Εͨ ԣάϥϑ͸େৎ෉ʁ େ෯վमͨ͠ͱ͜Ζ͸ ͖ͪΜͱදࣔ͞Ε͍ͯΔʁ ֬ೝ͢ΔϙΠϯτ͕ଟ͍ & ݟΔϙΠϯτ͕ҟͳΔ ใಓػؔͱͯ͠͸σʔλͷνΣοΫ͸ݫ͘͢͠Δඞཁ͕͋Δ͕ɾɾɾ

Slide 31

Slide 31 text

31

Slide 32

Slide 32 text

32

Slide 33

Slide 33 text

33 ໨diff!!!! (͜Ε͸σΟϨΫλʔ͕ਏ͍)

Slide 34

Slide 34 text

34 ໨diffؒҧ͍୳͠

Slide 35

Slide 35 text

35 ໨diffؒҧ͍୳͠

Slide 36

Slide 36 text

36 ࠷ऴతͳ൑அ͸ίϯϐϡʔλͰ͸ͳ͘ਓ͕ؒߦ͏͕ ͤΊͯ ֬ೝ͢ΔՕॴ͕໌֬ʹͳΕ͹͍͍ͷʹɾɾɾɾ

Slide 37

Slide 37 text

37 ͦ͏ͩʂ ϏδϡΞϧϦάϨογϣϯςετΛԠ༻ͯ͠ ͏·͍͜ͱ࢓૊ΈԽͰ͖ͳ͍ͩΖ͏͔ʁʁʁ

Slide 38

Slide 38 text

38 ࠩ෼ݕ஌ͷϓϩτλΠϓΛ࡞Δ 3

Slide 39

Slide 39 text

39 Try1 ϏδϡΞϧϦάϨογϣϯςετπʔϧreg-suit Ͱ΍ͬͯΈΑ͏

Slide 40

Slide 40 text

40 https://github.com/reg-viz/reg-suitΑΓҾ༻

Slide 41

Slide 41 text

NBTUFSϒϥϯν NBTUFS͔Β ੾ͬͨ࣌఺ͷϖʔδ QVTIͯ͠ ߋ৽͞Εͨϖʔδ ൺֱͯࠩ͠෼Λग़͢

Slide 42

Slide 42 text

(JU)VCʹQVTI͢Δ $*্Ͱ ϖʔδͷεΫϦʔϯγϣοτΛ࡞੒ SFHTVJUͰ εΫϦʔϯγϣοτೖͬͨσΟϨΫτϦΛࢦఆ 4ʹੜ੒ͨ͠ϖʔδΛ্͛Δ (JU)VCͷίϝϯτʹ ௨஌͕ඈͿ

Slide 43

Slide 43 text

(JU)VCʹQVTI͢Δ $*্Ͱ ϖʔδͷεΫϦʔϯγϣοτΛ࡞੒ SFHTVJUͰ εΫϦʔϯγϣοτೖͬͨσΟϨΫτϦΛࢦఆ 4ʹੜ੒ͨ͠ϖʔδΛ্͛Δ (JU)VCͷίϝϯτʹ ௨஌͕ඈͿ ؤுͬͯίʔυΛॻ͘ͷ͸ ͚ͩ͜͜ʂ

Slide 44

Slide 44 text

(JU)VCʹQVTI͢Δ $*্Ͱ ϖʔδͷεΫϦʔϯγϣοτΛ࡞੒ SFHTVJUͰ εΫϦʔϯγϣοτೖͬͨσΟϨΫτϦΛࢦఆ 4ʹੜ੒ͨ͠ϖʔδΛ্͛Δ (JU)VCͷίϝϯτʹ ௨஌͕ඈͿ ͜ΕҎ߱͸ SFHTVJU͕ࣗಈͰ΍ͬͯ͘Ε·͢

Slide 45

Slide 45 text

13্ʹϦάϨογϣϯςετͷ ݁ՌΛදࣔ͢Δػೳ EJ ff ͷϨϙʔτ΋ ࣗಈੜ੒Ͱ͖Δ

Slide 46

Slide 46 text

ઃఆͨ͠4ʹ Ϩϙʔτ͕ੜ੒͞ΕΔ ҰཡͱͳͬͯΘ͔Γ΍͍͢

Slide 47

Slide 47 text

ࠩ෼ͷݟͤํ΋ ύλʔϯ༻ҙ͞Ε͍ͯΔ

Slide 48

Slide 48 text

48 ͏·͍͔͘ͳ͔ͬͨϙΠϯτ1 ͜ͷίϯςϯπͰreg-suitΛ࢖͑ͳ͍ࣄ৘͕͋ͬͨ

Slide 49

Slide 49 text

(JU)VCͰ؅ཧ͍ͯ͠ͳ͍΋ͷ දࣔ͢Δσʔλࣗମ͸ 
 εϓϨουγʔτͰ؅ཧ (JU)VCͰ؅ཧ͍ͯ͠Δ΋ͷ )5.-΍$44΍ը૾ͳͲͷϦιʔε

Slide 50

Slide 50 text

هऀνʔϜ σβΠφʔɾΤϯδχΞνʔϜ εϓϨουγʔτͰ ຖ೔σʔλूܭˍνΣοΫ վम͕͋Δ৔߹ (JU)VCͰϦιʔε؅ཧ $JSDMF$*ͰϦϦʔε هऀνʔϜͷσʔλͱ σβΠφʔɾΤϯδχΞνʔϜͷ੒Ռ෺͕ ߹Θ͞Δͷ͸ຊ൪؀ڥ ˞΋ͪΖΜ։ൃ؀ڥ΋ଘࡏ͢Δ هऀνʔϜͷ ੹೚ऀ͕ެ։Λ൑அ

Slide 51

Slide 51 text

هऀνʔϜ σβΠφʔɾΤϯδχΞνʔϜ εϓϨουγʔτͰ ຖ೔σʔλूܭˍνΣοΫ վम͕͋Δ৔߹ (JU)VCͰϦιʔε؅ཧ $JSDMF$*ͰϦϦʔε ຖ೔ͷσʔλूܭͨ݁͠Ռ͕ (JU)VCͰ؅ཧ͞Ε͍ͯͳ͍

Slide 52

Slide 52 text

هऀνʔϜ σβΠφʔɾΤϯδχΞνʔϜ εϓϨουγʔτͰ ຖ೔σʔλूܭˍνΣοΫ վम͕͋Δ৔߹ (JU)VCͰϦιʔε؅ཧ $JSDMF$*ͰϦϦʔε ຊ൪؀ڥͷϖʔδͰ ࠓݱࡏදࣔ͞Ε͍ͯΔ΋ͷͱ աڈදࣔ͞Ε͍ͯͨ΋ͷΛൺֱ͍ͨ͠

Slide 53

Slide 53 text

53 ͏·͍͔͘ͳ͔ͬͨϙΠϯτ2 ຊ౰ʹ࢖ͬͯ΋Β͑Δ͔࣮༻ੑͷݒ೦ - GitHubʹ͔͠௨஌͕͜ͳ͍ɻ - هऀʹ΋GitHubΞΧ΢ϯτ͕ඞཁ - ࠩ෼ΛݟΔ·Ͱͷ໿4ΫϦοΫͷนΛӽ͑Δ - Slack νϟϯωϧ,GitHubͷPR,reg-suit,reg-suitͷத

Slide 54

Slide 54 text

54 ͏·͍͔͘ͳ͔ͬͨϙΠϯτ2 ຊ౰ʹ࢖ͬͯ΋Β͑Δ͔࣮༻ੑͷݒ೦ - GitHubʹ͔͠௨஌͕͜ͳ͍ɻ - هऀʹ΋GitHubΞΧ΢ϯτ͕ඞཁ - ࠩ෼ΛݟΔ·Ͱͷ໿4ΫϦοΫͷนΛӽ͑Δ - Slack νϟϯωϧ,GitHubͷPR,reg-suit,reg-suitͷத ຊ౰ʹ਺ճΫϦοΫͯ͘͠ΕΔʁʁʁ Θ͟Θ͟ݟΔͷΊΜͲ͘͘͞ͳ͍ʁʁʁ

Slide 55

Slide 55 text

55 ͜͏ͳͬͨΒ͍͍ͳͱໝ૝ͯͨ͜͠ͱ Nikkei ———— ———— ———— ———— ௨஌νϟϯωϧ ௨஌bot 1Click ͲΜͳ৬छͰ΋ ͚ͩ͜͜ݟ͓͚ͯ͹͍͍ʂ ͱ͍͏ঢ়ଶΛ࡞Γ͍ͨ ———— ———— ————

Slide 56

Slide 56 text

56 ͜͏ͳͬͨΒ͍͍ͳͱໝ૝ͯͨ͜͠ͱ Nikkei ———— ———— ———— ———— ௨஌νϟϯωϧ ௨஌bot 1Click ͲΜͳ৬छͰ΋ ͚ͩ͜͜ݟ͓͚ͯ͹͍͍ʂ ঢ়ଶΛ࡞Γ͍ͨ ֬ೝ͢Δ΂͖Օॴ͕໌֬ʹʂ ࠷ऴతͳਓؒͷ൑அͷิॿʹͳΔʂ(͸ͣ)

Slide 57

Slide 57 text

57 ཁ݅Λߟ͑Δ ɾهऀνʔϜଆ͕σʔλΛߋ৽͢Δͱ͖ʹɺࣗಈͰલͷঢ়ଶͱࠓͷঢ়ଶͱͦͷࠩ෼͕දࣔ͢Δ ɾ৬छ໰Θͣɺ୭΋͕ͦͷࠩ෼Λ֬ೝ͢Δ͜ͱ͕Ͱ͖Δঢ়ଶʹ͢Δ ɾ࿈བྷखஈʹSlackΛར༻͍ͯ͠ΔͷͰɺͦͷ݁Ռ͕Slackʹ·ͱΊΒΕΔͱΑ͍

Slide 58

Slide 58 text

58 αΫοͱϓϩτλΠϓΛ ࡞ͬͯΈΔ SFHTVJUͰֶΜͩ͜ͱΛ׆͔ͯ͠

Slide 59

Slide 59 text

59 ࠩ෼Λݕग़ͯ͠ɺSlackʹ౤Լ͢Δ͘͠ΈΛߟ͑ͨ 1.ར༻͢Δπʔϧ΍ϥΠϒϥϦྨΛબఆ͢Δ 2.࣮ߦํ๏ΛܾΊΔ 3.ൺֱը૾Λ༻ҙ͢Δ 4.ը૾ͷߴ͞Λἧ͑ͯɺൺֱ΍Ճ޻͠΍͘͢͢Δ 5.ը૾ͷࠩ෼Λݕग़͢ΔͨΊͷ४උΛ͢Δ 6.ը૾ͷࠩ෼Λݕग़͢Δ 7.ࠩ෼͕͋Ε͹࡞੒ͨ͠εΫϦʔϯγϣοτΛS3ʹΞοϓϩʔυ͢Δ 8.Slack౤ߘ༻ʹը૾Λ߹੒͢Δ 9.Slackʹ౤ߘ͢Δ

Slide 60

Slide 60 text

60 1.ར༻͢Δπʔϧ΍ϥΠϒϥϦྨΛબఆ͢Δ ը૾Ͱࠩ෼Λݕग़͢ΔͳΒ →OpenCV͕࢖͑ͯ Webը૾ΛεΫγϣ͢ΔͳΒˠWebࣗಈԽπʔϧͰεΫγϣΛͱΖ͏ աڈը૾Λอଘ͢ΔͳΒˠS3͕ྑͦ͞͏ ·͋ɺϓϩτλΠϓͩͬ͠͞ͱPythonͰࢼͦ͏ʂ Ұ୴Google ColaboratoryͰϛχϛχϓϩτλΠϓΛ࡞ͬͯΈΔ →ΠέΔʂΛ֬৴

Slide 61

Slide 61 text

61 2.࣮ߦํ๏ΛܾΊΔ Google Colaboratory Ͱܾ·ͬͨ࣌ؒʹىಈͰ͖ͨΒ͍͍ͷʹ ࠓͷܖ໿ͩͱͰ͖ͳ͔ͬͨͷͰ GitHubͱ࿈ܞ͍ͯ͠ΔCircleCIͰɺ σʔλ੔ܗͱ൓ө͕ऴΘΔޕޙ̑࣌ʹ࣮ߦ͢Δ͜ͱʹ ※Pro+ͩͱεέδϡʔϧػೳ͕͋Γ·͢ (https://github.com/googlecolab/colabtools/wiki/Scheduled-notebooks)

Slide 62

Slide 62 text

$JSDMF$*Ͱ ϖʔδͷεΫγϣΛੜ੒ 4͔Βલճߋ৽࣌ʹࡱӨͨ͠ εΫγϣΛμ΢ϯϩʔυ 62 3.ൺֱը૾Λ༻ҙ͢Δ

Slide 63

Slide 63 text

$JSDMF$*Ͱ ϖʔδͷεΫγϣΛੜ੒ 4͔Βલճߋ৽࣌ʹࡱӨͨ͠ εΫγϣΛμ΢ϯϩʔυ 63 3.ൺֱը૾Λ༻ҙ͢Δ

Slide 64

Slide 64 text

64 SCREENSHOT_WIDTH_SIZE = 800 SCREENSHOT_HIGHT_SIZE = 12000 TARGET_URL = "https://vdata.nikkei.com/newsgraphics/coronavirus-japan-vaccine- status/" WAIT_TIME = 10 # ΢ΣϒυϥΠόʔͱΦϓγϣϯͷઃఆ options = webdriver.ChromeOptions() options.add_argument('--headless') options.add_argument('--incognito') options.add_argument('--no-sandbox') options.add_argument('--disable-dev-shm-usage') driver = webdriver.Chrome(ChromeDriverManager().install(), options=options) driver.get(TARGET_URL) driver.set_window_size(SCREENSHOT_WIDTH_SIZE, SCREENSHOT_HIGHT_SIZE) time.sleep(WAIT_TIME) driver.save_screenshot("test-reports/current_page_screenshot.png") ※ίʔυ͸Ұ෦ൈਮ

Slide 65

Slide 65 text

$JSDMF$*Ͱ ϖʔδͷεΫγϣΛੜ੒ 4͔Βલճߋ৽࣌ʹࡱӨͨ͠ εΫγϣΛμ΢ϯϩʔυ 65 3.ൺֱը૾Λ༻ҙ͢Δ

Slide 66

Slide 66 text

66 # S3ʹΞοϓϩʔυ import boto3 # S3ͷϑΝΠϧμ΢ϯϩʔυɺΞοϓϩʔυͷઃఆ client = boto3.client( 's3', aws_access_key_id= {AWS ΞΫηεΩʔID}, aws_secret_access_key= {AWS γʔΫϨοτΩʔ}, ) client.download_file( '{S3໊}', '{S3ͷύε໊}/screenshot.png', 'test-reports/past_page_screenshot.png' ) ※ίʔυ͸Ұ෦ൈਮ

Slide 67

Slide 67 text

଍Γͳ͍௕͞͸0QFO$7Ͱ ന৭෦෼Λ௥Ճͯ͠ௐ੔ 4.ը૾ͷߴ͞Λἧ͑ͯɺൺֱ΍Ճ޻͠΍͘͢͢Δ

Slide 68

Slide 68 text

68 #=============================================== #ɹಉ͡αΠζʹͳΔΑ͏ʹԼʹۭനΛೖΕͯϦαΠζ #=============================================== color = (255, 255, 255) if img_current.shape[0] <= img_past.shape[0]: bottom = img_past.shape[0] - img_current.shape[0] img_current = cv2.copyMakeBorder(img_current, 0,bottom, 0, 0, cv2.BORDER_CONSTANT, value=color, ) else: bottom = img_current.shape[0] - img_past.shape[0] img_past = cv2.copyMakeBorder(img_past, 0, bottom, 0, 0, cv2.BORDER_CONSTANT, value=color, ) ※ίʔυ͸Ұ෦ൈਮ

Slide 69

Slide 69 text

มߋલͱมߋޙΛൺֱͯ͠ ࠩ෼ϚεΫΛ࡞੒͢Δ 5.ը૾ͷࠩ෼Λݕग़͢ΔͨΊͷ४උΛ͢Δ

Slide 70

Slide 70 text

70 #=============================================== # ը૾ͷࠩ෼Λ࡞Δ #=============================================== fgbg = cv2.bgsegm.createBackgroundSubtractorMOG(history=2) #ϚεΫͷܭࢉ fgmask = fgbg.apply(img_current) fgmask = fgbg.apply(img_past) cv2.imwrite('test-reports/mask.png', fgmask) ※ίʔυ͸Ұ෦ൈਮ

Slide 71

Slide 71 text

6.ը૾ͷࠩ෼ΛΘ͔Γ΍͘͢͢Δ ϚεΫ͚ͩͩͱࠩ෼͕Θ͔Βͳ͍ͷͰ ը૾Λ҉ͯ͘͠ॏͶΔ

Slide 72

Slide 72 text

72 #=============================================== # ը૾Λ҉ͯࠩ͘͠෼ϚεΫΛॏͶɺ # ࠩ෼ͷݕग़ͷ݁Ռ͕෼͔ΔΑ͏ʹग़ྗ͢Δ #=============================================== # ݱࡏͷεΫγϣΛগ͠҉͘͢Δ img_result = img_current // 4 # ϚεΫͰࠩ෼ͷ͋Δͱ͜Ζ͚ͩ྘ΛࡌͤΔ img_result[fgmask==255] = (0, 255, 0) cv2.imwrite('test-reports/result.png', img_result) ※ίʔυ͸Ұ෦ൈਮ

Slide 73

Slide 73 text

8.Slack౤ߘ༻ʹը૾Λ߹੒͢Δ 4MBDLͰ௨஌ͨ͠ͱ͖ʹΘ͔Γ΍͍͢Α͏ʹ มߋલɺมߋޙɺࠩ෼ͷ̏ͭΛ଍͠߹Θͤ Ұͭͷը૾ʹ͢Δ

Slide 74

Slide 74 text

8.Slack౤ߘ༻ʹը૾Λ߹੒͢Δ ͜͏ͳΔͱɺ Կ͕Ͳ͏มΘ͍ͬͯΔͷ͔Θ͔Βͳ͍

Slide 75

Slide 75 text

75 #============================= # ը૾ͷ߹੒(Slack౤ߘ༻) #============================= percentage_to_resize = 0.5 img_summary = cv2.hconcat([img_current, img_past, img_result]) img_summary = cv2.resize( img_summary , (int(img_summary.shape[1] * percentage_to_resize), int(img_summary.shape[0] * percentage_to_resize)) ) cv2.imwrite('test-reports/summary.png', img_summary) ※ίʔυ͸Ұ෦ൈਮ

Slide 76

Slide 76 text

7.ࠩ෼͕͋Ε͹࣍ճͷൺֱ༻ʹ࡞੒ͨ͠εΫϦʔϯ γϣοτΛS3ʹΞοϓϩʔυ͢Δ Կ΋͠ͳ͍ ࠩ෼͋Γʂ 4΁ ࠩ෼ͳ͠ʂ

Slide 77

Slide 77 text

77 #======================================================= # S3ʹը૾ΛΞοϓϩʔυ͢Δ #======================================================= client.upload_file( 'test-reports/current_page_screenshot.png', '{S3໊}', ‘{S3ͷύε໊}/screenshot.png' ) ※ίʔυ͸Ұ෦ൈਮ

Slide 78

Slide 78 text

9.Slackʹ౤ߘ͢Δ Ұຕʹ·ͱΊͨํ͕ݟ΍͍͢ʂ

Slide 79

Slide 79 text

มߋޙ มߋલ ࠩ෼

Slide 80

Slide 80 text

80 ໨diffؒҧ͍୳͠(αϙʔτ෇͖)

Slide 81

Slide 81 text

81 #====================================================== # ࠩ෼͕͋Ε͹files uploadAPIͰSlackʹ௨஌ #====================================================== def postMessageWithFiles(message, fileList, channel): slack_client = slack_sdk.WebClient(token=SLACK_TOKEN) for file in fileList: upload = slack_client.files_upload(file=file, filename=file) message = message + ”<“ + upload['file']['permalink'] + "| >" outPut = slack_client.chat_postMessage( channel = channel, text = message ) #======================================================= # มߋΛݕ஌ͨ࣌͠ #======================================================= if np.array_equal(img_current, img_past): postMessageWithFiles( message = " `ίϩφ೔ຊϫΫνϯίϯςϯπͷࠩ෼Λݕ஌͠·ͨ͠ʂ”, fileList = ['test-reports/summary.png'], channel = "{௨஌͍ͨ͠νϟϯωϧ໊}", ) ※ίʔυ͸Ұ෦ൈਮ

Slide 82

Slide 82 text

82 ※ίʔυ͸Ұ෦ൈਮ ΋͠΋ະདྷͰɺ ࠩ෼Λݟ͍ͨϖʔδ͕ෳ਺ʹ૿͑ͨ࣌

Slide 83

Slide 83 text

83 ݁Ռͱ·ͱΊ 3

Slide 84

Slide 84 text

84 هऀ
 σβΠφʔ ΤϯδχΞ ศརͳ࢓૊ΈΛ ͋Γ͕ͱ͏͍͟͝·͢ ໌Β͔ʹ͓͔͍͠Օॴ͕ͳ͍͔ ؆୯ʹ൑ผͰ͖Δͷ͸͋Γ͕͍ͨ σʔλͷܻ਺ʹΑͬͯϨΠΞ΢τ͕ มΘΔཁૉ͕͋Δɻ ҙਤ͍ͯ͠ͳ͍ϨΠΞ΢τʹ ͳ͍ͬͯͳ͍͔͕Ұ໨Ͱ෼͔Δͷ͕ ྑ͍ ಋೖޙͷ੠

Slide 85

Slide 85 text

85 هऀ
 σβΠφʔ ΤϯδχΞ ศརͳ࢓૊ΈΛ ͋Γ͕ͱ͏͍͟͝·͢ ໌Β͔ʹ͓͔͍͠Օॴ͕ͳ͍͔ ؆୯ʹ൑ผͰ͖Δͷ͸͋Γ͕͍ͨ σʔλͷܻ਺ʹΑͬͯϨΠΞ΢τ͕ มΘΔཁૉ͕͋Δɻ ҙਤ͍ͯ͠ͳ͍ϨΠΞ΢τʹ ͳ͍ͬͯͳ͍͔͕Ұ໨Ͱ෼͔Δͷ͕ྑ͍ ಋೖޙͷ੠ Ͱ΋ɾɾɾɾ ͩΜͩΜݟΒΕͳ͘ͳͬͯ͠·͏

Slide 86

Slide 86 text

86 هऀ
 σβΠφʔ ΤϯδχΞ ޕޙ̑࣌ఆظ࣮ߦ͡Όͳͯ͘ ग़͢௚લʹνΣοΫͰ͖ΔΑ͏ͳػߏ ͕Α͔ͬͨ վળϙΠϯτ

Slide 87

Slide 87 text

هऀνʔϜ σβΠφʔɾΤϯδχΞνʔϜ εϓϨουγʔτͰ ຖ೔σʔλूܭˍνΣοΫ վम͕͋Δ৔߹ (JU)VCͰϦιʔε؅ཧ $*ͰϦϦʔε ͜ͷ࣌఺Ͱެ։ͱಉ࣌ʹ -BNCEBΛىಈ ͞Βʹվળ͢ΔͳΒ

Slide 88

Slide 88 text

88 هऀ
 σβΠφʔ ΤϯδχΞ ผͷϒϥ΢β΍ϞόΠϧαΠζͳͲ ͍Ζ͍Ζͳը໘ύλʔϯͰ ݕূͰ͖ͨ΄͏͕҆৺ײ͕ߴ·Δɻ վળϙΠϯτ ίϯςϯπ಺ͷ্෦ͷจষ͕ มߋ͞Εͯɺߦ਺͕มΘͬͯ͠ ·͏ͱϨΠΞ΢τ͕͢΂ͯԼʹ ͣΕͨͱݕग़͞ΕΔͱ͍͏৔߹ ͕͋Δɻ

Slide 89

Slide 89 text

هऀνʔϜ σβΠφʔɾΤϯδχΞνʔϜ εϓϨουγʔτͰ ຖ೔σʔλूܭˍνΣοΫ վम͕͋Δ৔߹ (JU)VCͰϦιʔε؅ཧ $*ͰϦϦʔε άϥϑͷը૾ͷݕग़͚ͩʹಛԽ ͞Βʹվળ͢ΔͳΒ

Slide 90

Slide 90 text

90 Pythonͷศར͞ ΍Γ͍ͨ͜ͱʹରͯ͠ɺπʔϧ͕ἧ͍ͬͯͯ ਺ेߦͰ͙͢ʹࢼ͢͜ͱ͕Ͱ͖Δշద͕͞࠷ߴ

Slide 91

Slide 91 text

91 هऀ
 σβΠφʔ ΤϯδχΞ ۀ຿վળͷ໘ന͍ϙΠϯτ ͍ͭ΋΍͍ͬͯΔ ಉ͡ܗࣜ֬ೝ࡞ۀ ͍ͭ΋΍ͬͯΔ͚Ͳ ຊ൪Ͱຖ೔ ֬ೝ͢Δ͔͠ͳ͍ͷ͔ͳʙ

Slide 92

Slide 92 text

92 هऀ
 σβΠφʔ ΤϯδχΞ ۀ຿վળͷ໘ന͍ϙΠϯτ ͍ͭ΋΍͍ͬͯΔ ಉ͡ܗࣜ֬ೝ࡞ۀ ͍ͭ΋΍ͬͯΔ͚Ͳ ຊ൪Ͱຖ೔ ֬ೝ͢Δ͔͠ͳ͍ͷ͔ͳʙ ʮ͜͏ͳͬͨΒ͍͍ͷʹͳʙʯ͸ɺࠔ͍ͬͯΔຊਓ͔Β ϐϯϙΠϯτͰ͸དྷͳ͍

Slide 93

Slide 93 text

93 هऀ
 σβΠφʔ ΤϯδχΞ ۀ຿վળͷ໘ന͍ϙΠϯτ ͲΜͳײ͡Ͱ ࡞ۀ͍ͯ͠ΔΜͰ͔͢ʁʁ

Slide 94

Slide 94 text

94 هऀ
 σβΠφʔ ΤϯδχΞ ۀ຿վળͷ໘ന͍ϙΠϯτ ͜Μͳखஈ͋Γ·͢Αʁ ͜͏ͨ͠Β͍͍͔΋ʁ ͦΜͳ͜ͱͰ͖Δͷʁʁʂʂ ศརʂͦΕ΄͍͠ʂ

Slide 95

Slide 95 text

95 ·ͱΊ νʔϜͷಇ͖ํΛ͞Βʹշదʹ͢ΔͨΊͷछ͕ ೔ʑͷίϛϡχέʔγϣϯͷதʹ͋Δ͔΋ʁʂ

Slide 96

Slide 96 text

96 https://hack.nikkei.com/

Slide 97

Slide 97 text

97 ͋Γ͕ͱ͏͍͟͝·ͨ͠