Cheatography
https://cheatography.com
Pycaffe library
Caffe is one of the renowned deep learning frameworks which was developed by Berkeley AI Research (BAIR). It is an open source framework for deep learning models and its explicit use. Caffe is purely coded on C++ and Cuda library which makes it fast,compatible and easy to use. Caffe library is integrated with python and matlab interfaces for deep learning practinary
Net
The main class that the pycaffe interface exposes is the Net. It has two constructors: |
Create a Net (in this case using the Data Layer specified for training) |
net = caffe.Net('/path/prototxt/descriptor/file', caffe.TRAIN) |
Creates a Net and automatically loads the weights as saved in the provided caffemodel file - in this case using the Data Layer specified for testing. |
net = caffe.Net('/path/prototxt/descriptor/file', '/path/caffemodel/weights/file', caffe.TEST) |
Parameters
nice_edge_detectors = net.params['conv'].data |
higher_level_filter = net.params['fc'].data |
backward()
Computing gradients |
net.backward(start='conv1', end='fc') |
softmax_probabilities = net.blobs['prob'].data |
Transformer
transformer = caffe.io.Transformer({'data': (1, image.shape[2], image.shape[0], image.shape[1])}) |
Monitoring
tools.solvers.MonitoringSolver |
Prediction
pred = net.predict([input]) |
|
|
Net.blobs
data = net.blobs['data'].data |
net.blobs['data'].data[...] = my_image |
fc_activations = net.blobs['fc'].data |
Solver iteration
A forward/backward pass with weight update |
solver.step(1) |
Run the solver until the last iteration |
solver.solve() |
forward()
Add Data to the net |
net.forward(start='conv', end='fc') |
softmax_probabilities = net.blobs['prob'].data |
Solver
Solver needed in order to train a caffe mode |
solver = caffe.SGDSolver('/path/to/solver/prototxt/file') |
The networks are accessible with |
The networks are accessible with |
training_net = solver.net test_net = solver.test_nets[0] # more than one test net is supported |
Data augmentation
tools.data_augmentation |
Transformation
tools.prototxt.train2deploy |
Pre-processing
import tools.pre_processing |
Image Input
input_image = caffe.io.load_image(IMAGE_FILE) |
|
Created By
Metadata
Favourited By
Comments
Aishani, 13:32 11 Aug 21
Amazing cheat sheet!
Add a Comment
Related Cheat Sheets