Using NCSDK 1.12.00, lastest as of April 2018
| Version | Average Inference Time |
|---|
| import torch | |
| import torch.nn as nn | |
| from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence | |
| seqs = ['gigantic_string','tiny_str','medium_str'] | |
| # make <pad> idx 0 | |
| vocab = ['<pad>'] + sorted(set(''.join(seqs))) | |
| # make model |
Using NCSDK 1.12.00, lastest as of April 2018
| Version | Average Inference Time |
|---|
| #!/usr/bin/env python | |
| '''Caffe ResNet NetSpec example. | |
| Compatible with Kaiming He's pre-trained models. | |
| https://github.com/KaimingHe/deep-residual-networks | |
| ''' | |
| import sys |
This tutorial will guide through the steps to create a simple custom layer for Caffe using python. By the end of it, there are some examples of custom layers.
Usually you would create a custom layer to implement a funcionality that isn't available in Caffe, tuning it for your requirements.
Probably just Python and Caffe instaled.
| void CVMatToDatum(const cv::Mat& cv_img, Datum* datum, int depth) | |
| { | |
| if (depth == CV_8U) { | |
| CVMatToDatum(cv_img, datum); | |
| return; | |
| } | |
| CHECK(cv_img.depth() == CV_32F) << "data type must be 32bit float"; | |
| datum->set_channels(cv_img.channels()); |
| #include <opencv2/opencv.hpp> | |
| #include <iostream> | |
| #include <vector> | |
| #include <cmath> | |
| #include <assert.h> | |
| using namespace std; | |
| using namespace cv; |
##VGG16 model for Keras
This is the Keras model of the 16-layer network used by the VGG team in the ILSVRC-2014 competition.
It has been obtained by directly converting the Caffe model provived by the authors.
Details about the network architecture can be found in the following arXiv paper:
Very Deep Convolutional Networks for Large-Scale Image Recognition
K. Simonyan, A. Zisserman
The IPython Notebook has two different keyboard input modes. Edit mode allows you to type code/text into a cell and is indicated by a green cell border. Command mode binds the keyboard to notebook level actions and is indicated by a grey cell border.