Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Wantedly Peopleのスキャン画面の裏側 / Wantedly People Scanning Screen

Wantedly Peopleのスキャン画面の裏側 / Wantedly People Scanning Screen

2017/05/31 Wantedly技術見学会 iOS編

Shinichi Goto

May 31, 2017
Tweet

More Decks by Shinichi Goto

Other Decks in Technology

Transcript

  1. Wantedly Peopleͷ
    εΩϟϯը໘ͷཪଆ
    ɹ
    2017/05/31 Wantedlyٕज़ݟֶձ iOSฤ
    shingt (Shinichi Goto) @ Wantedly, Inc.

    View full-size slide

  2. shingt (Shinichi Goto)
    GitHub: @shingt
    Twi5er: @_shingt

    View full-size slide

  3. Outline
    • εΩϟϯը໘ͷॲཧͷྲྀΕ
    • ٕज़ཁૉ / ߏ੒
    • ෆ҆ఆͳݕग़݁Ռ΁ͷରॲ
    • σόοά൛ͷ࿩

    View full-size slide

  4. εΩϟϯը໘ͷॲཧͷྲྀΕ

    View full-size slide

  5. ٕज़ཁૉ / ߏ੒

    View full-size slide

  6. • AVFounda*on
    • OpenCV
    • ίϯϐϡʔλϏδϣϯ༻ͷϥΠϒϥϦ
    • ໊ࢗྖҬͷݕग़ɺͦͷଞը૾ॲཧʹར༻
    • ಛผͳ΋ͷ͸࢖͍ͬͯͳ͍

    View full-size slide

  7. ໊ࢗݕग़ͷOpenCVҎ֎ͷબ୒ࢶ
    • CoreImage
    • Accerelate (BNNS)
    • Metal (CNN)
    • TensorFlow

    View full-size slide

  8. ݕग़ϩδοΫ͸Androidͱڞ௨Խ͍ͨ͠
    ʢগͳ͘ͱ΋ॳظϦϦʔεͰ͸ʣ

    View full-size slide

  9. => Accerelate / Metal / CoreImage ͸ݟૹΓ
    ʢલऀ2ͭ͸iOS9Ͱར༻Ͱ͖ͳ͍໰୊΋ʣ

    View full-size slide

  10. TensorFlow
    • ΞϓϦʹ૊ΈࠐΈɺผ్ֶशࡁͷϞσϧΛద༻ɺͱ͍͏ͱ͜Ζ
    ·Ͱ͸ࢼͨ͠
    • ໊ࢗݕग़෦෼΁ͷ࣮ࡍͷ׆༻ʹ͸ࢸΒͣ
    • ։ൃظؒɺσʔληοτɺਫ਼౓ͷ໰୊

    View full-size slide

  11. ༨ஊ: Google I/O '17
    pod 'TensorFlow-experimental'
    ɹ
    • Android Meets TensorFlow: How to Accelerate Your App with AI
    • "experimental" Ͱͳ͍ํ͸ "Coming soon" ͱͳͬͯΔ
    • h?ps:/
    /cocoapods.org/pods/TensorFlow

    View full-size slide

  12. ɹ
    • OpenCV
    • C++Ͱهड़͞ΕͨΠϯλʔϑΣΠεΛར༻
    • => Swi/͔Βͷ௚઀ͷݺͼग़͠͸ෆՄ
    • ʢඞવతʹʣݕग़ؔ࿈ͷϩδοΫ͸Objec3ve-C++ଆʹدͤΔ

    View full-size slide

  13. // CardDetector.mm
    - (NSArray *)cardFeaturesInMat:(const cv::Mat &)mat
    {
    std::vector cards = ... // Detect cards on C++ layer
    NSMutableArray *cardFeatures = [NSMutableArray array];
    for (const auto& card : cards) {
    if (!card.is_namecard) continue;
    CardFeature *cardFeature = [[CardFeature alloc] initWithDTCTCard:card];
    [cardFeatures addObject:cardFeature];
    }
    return cardFeatures;
    }

    View full-size slide

  14. CardDetector
    • C++ͷϨΠϠ΁ͷProxyʹ͍ۙҐஔ
    • ࣮ࡍʹ͸͋Δఔ౓ը૾ॲཧϩδοΫ΋ؚΉ
    • ࠲ඪิਖ਼ɺಁࢹม׵ɺetc.
    • σόΠεଆͰಈ͔ͯ͠ΈͯॳΊͯݟ͔ͭΔɺͱ͍͏໰୊΋͋ͬ
    ͨͨΊ

    View full-size slide

  15. C++ͷϨΠϠ
    • ੾Γग़ͯ͠։ൃ & ୯ಠͰϏϧυ
    • ΞϓϦશମΛϏϧυ͢Δͷʹൺ΂ͯѹ౗తʹ଎͍ͨΊ
    • ݕग़෦෼ͷϩδοΫΛվળ͠΍͍͢ʢ΋ͬͱجຊతͳ෦෼͸
    PythonͰ࣮ݧʣ
    • దٓiOSϓϩδΣΫτ΁औΓࠐΈ

    View full-size slide

  16. ෆ҆ఆͳݕग़݁Ռ΁ͷରॲ

    View full-size slide

  17. ໊ࢗྖҬͷݕग़

    View full-size slide

  18. AVCaptureStillImageOutput ʢ੩ࢭը༻ʣ
    OR
    AVCaptureVideoDataOutputʢಈը༻ʣ

    View full-size slide

  19. ໊ࢗεΩϟϯʹγϟολʔԻ͸໐Βͨ͘͠ͳ͍
    => AVCaptureVideoDataOutput

    View full-size slide

  20. ໰୊: iPhone͸༳ΕΔ

    View full-size slide

  21. ղܾࡦ: γʔέϯεͱͯ͠ѻ͏

    View full-size slide

  22. ݕग़݁Ռͷ౤ථ
    • ϑϨʔϜͷ઱໌౓ʢͲΕ͚ͩϒϨ͍ͯͳ͍͔ʣ
    • ϥϓϥγΞϯϑΟϧλΛ͔͚ͨ݁Ռͷ෼ࢄʢͰ͋Δఔ౓ݟΕ
    Δʣ
    • ݕग़໊ࢗຕ਺
    • ͲΕ͚ͩ௚ۙͷϑϨʔϜ͔

    View full-size slide

  23. ࢀߟ: ઱໌౓ͷԋࢉ
    @implementation UIImage (CVExtension)
    - (double)sharpness
    {
    cv::Mat mat, gray, laplacian;
    UIImageToMat(self, mat);
    cv::cvtColor(mat, gray, CV_BGR2GRAY);
    cv::Laplacian(gray, laplacian, CV_64F);
    cv::Scalar mean, stddev;
    cv::meanStdDev(laplacian, mean, stddev, cv::Mat());
    return stddev.val[0] * stddev.val[0];
    }
    @end

    View full-size slide

  24. τϥοΩϯά࣌

    View full-size slide

  25. ɹ
    • ݁ߏ҆௚ͳղܾࡦͰ͸͋Δ
    • ͱ͸͍͑ܶతʹମݧ͸޲্ !

    View full-size slide

  26. σόοά൛ͷ࿩

    View full-size slide

  27. ϦΞϧλΠϜͳը૾ॲཧΞϓϦͷ։ൃͰࠔΔ͜ͱ
    • ໰୊ൃੜ࣌ɺݱঢ়೺Ѳʹ͕͔͔࣌ؒΓ΍͍͢
    • ϓϩηεͷͲͷ෦෼͕ѱ͍ͷ͔
    • ઢ෼ݕग़ʁ࠲ඪม׵ʁ઱໌౓ͷԋࢉʁ

    View full-size slide

  28. Debug, QAͰ͸
    • ԋࢉঢ়گɺϦιʔεঢ়گΛදࣔ
    • ઱໌౓, γʔέϯεॲཧ, CPU, etc.
    • ը૾ॲཧͷաఔΛදࣔ

    View full-size slide

  29. ɹ
    • ࢹ֮తʹ෼͔Γ΍͍ͨ͢Ί໰୊Λݟ͚ͭ΍͍͢
    • ͍͚ͦ͏ײ͕CEOʹ఻ΘΔ

    View full-size slide

  30. ·ͱΊ
    • εΩϟϯը໘ͷॲཧͷྲྀΕ / ٕज़ཁૉ / ߏ੒ Λ঺հ
    • ෆ҆ఆͳݕग़݁Ռ΁ͷରॲ => γʔέϯεຖʹॲཧ
    • "ΊͪΌͪ͘ΌεϚʔτʂ" ͳ͜ͱ͸ͯ͠ͳ͍ʢݱঢ়͸ʣ
    • Debug/QA൛ͰॲཧաఔɺϦιʔεঢ়گΛग़͓ͯ͘͠
    • ࢒Γ͸ޙ೔BlogͰެ։ʢ͢Δ͔΋ʣ

    View full-size slide