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

Caffeでお手軽本格ディープラーニングiOSアプリ

 Caffeでお手軽本格ディープラーニングiOSアプリ

@potatotips #22
#DeepLearning #MachineLearning

Takuya Matsuyama

October 13, 2015
Tweet

More Decks by Takuya Matsuyama

Other Decks in Technology

Transcript

  1. UIImage* image = [UIImage imageNamed:@"sample.jpg"]; cv::Mat src_img, img; UIImageToMat(image, src_img);

    cv::cvtColor(src_img, img, CV_RGBA2BGRA); ը૾ͷಡΈࠐΈ w 6**NBHFΛಡΈࠐΈ w DW.BUܗࣜʹม׵ w Χϥʔ഑ྻΛ3(#"͔Β#(3"ʹม׵
  2. // ϑΝΠϧύεΛstringܕʹม׵ string model_file_str = std::string([model_file UTF8String]); string label_file_str =

    std::string([label_file UTF8String]); string trained_file_str = std::string([trained_file UTF8String]); string mean_file_str = std::string([mean_file UTF8String]); Classifier classifier = Classifier(model_file_str, trained_file_str, mean_file_str, label_file_str); $MBTTJpFSͷॳظԽ w ϞσϧఆٛɺϥϕϧɺֶशࡁΈϞσϧɺฏۉը૾ͷύεΛऔಘ w ֤ϑΝΠϧύεΛTUETUSJOHʹม׵ w $MBTTJpFSͷΠϯελϯεΛ࡞੒
  3. for (std::vector<Prediction>::iterator it = result.begin(); it != result.end(); ++it) {

    NSString* label = [NSString stringWithUTF8String:it->first.c_str()]; NSNumber* probability = [NSNumber numberWithFloat:it->second]; NSLog(@"label: %@, prob: %@", label, probability); } ࣝผ݁Ռͷग़ྗ w TUEWFDUPSܗࣜͰෳ਺ͷࣝผީิ͕ಘΒΕΔ w JUFSBUPSͰճ֤ͯ͠ީิΛऔಘ w JUpSTUϥϕϧɺJUTFDPOE֬཰