ROSRelative
目录
Caffe Introduce
- a deep learning framework that provides an easy and straightforward way to experiment with deep learning and leverage community contributions of new models and algorithms.
- Caffe2 is built to excel at utilizing both multiple GPUs on a single-host and multiple hosts with GPUs. PyTorch is great for research, experimentation and trying out exotic neural networks, while Caffe2 is headed towards supporting more industrial-strength applications with a heavy focus on mobile.
- easy to converting from Pytorch
- easy, built-in distributed training. This means that you can very quickly scale up or down without refactoring your design.
Caffe2 improves Caffe 1.0 in a series of directions:
- first-class support for large-scale distributed training
- mobile deployment
- new hardware support (in addition to CPU and CUDA)
- flexibility for future directions such as quantized computation
- stress tested by the vast scale of Facebook applications
Distribute Training
- Gloo: Caffe2 leverages, Gloo, a communications library for multi-machine training.
- NCCL: Caffe2 also utilize’s NVIDIA’s NCCL for multi-GPU communications.
- Redis To facilitate management of nodes in distributed training, Caffe2 can use a simple NFS share between nodes, or you can provide a Redis server to handle the nodes’ communications. 实践的时候在细看
DataSets:
NAME | TYPE | DOWNLOAD |
---|---|---|
AlexNet-Places205 | ||
AN4: 948 training and 130 test utterances | ||
BSDS (300/500): 12k labeled segmentations | images segmentations | |
Celeb-A: 200k+ celebrity images, 10k+ identities | ||
CIFAR-10: 60k tiny (32x32) tagged images | ||
COCO: A large image dataset designed for object detection, segmentation, and caption generation. | ||
CompCars: 136k+ car images & 1716 car models | ||
Oxford 102 Flowers: 102 flower categories | images segmentations | |
ImageNet: 14,197,122 images, 21841 synsets indexed | ||
ImageNet ILSVRC: Competition datasets | ||
Iris | ||
LSUN Scenes millions of indoor/outdoor building scenes | ||
LSUN Room Layout 4000 indoor scenes | ||
MNIST 60k handwriting training set, 10k test images | ||
Multi-Salient-Object (MSO) 1224 tagged salient object images | ||
OUI-Adience Face Image 26,580 age & gender labeled images | ||
PASCAL VOC 2012 11,530 images w/ 27,450 ROI annotated objects and 6,929 segmentations | ||
PCAP Network captures of regular internet traffic and attack scenario traffic | ||
Penn Treebank (PTB) statistical language modeling | ||
UCF11/YouTube Action 11 action categories: basketball shooting, biking/cycling, diving, golf swinging, horse back riding, soccer juggling, swinging, tennis swinging, trampoline jumping, volleyball spiking, and walking with a dog | ||
UCI Datasets | ||
US Census: demographic data | ||
VGG-Face millions of faces | ||
LibriSpeech 1000 hours free speech recognition traning dataset |
Downloading and Importing Caffe2 Models
- simpe predictions:
- a protobuf that defines the network
- a protobuf that has all of the network weights
with open(path_to_INIT_NET) as f:
init_net = f.read()
with open(path_to_PREDICT_NET) as f:
predict_net = f.read()
p = workspace.Predictor(init_net, predict_net)
#downlaod a Model as a module
python -m caffe2.python.models.download --install squeezenet
#error try;sudo PYTHONPATH=/usr/local python -m caffe2.python.models.download --install
#If the above download worked then you should have a copy of squeezenet in your model folder or if you used the -i flag it will have installed the model locally in the /caffe2/python/models folder.
from caffe2.python import workspace
from caffe2.python.models import squeezenet as mynet
import numpy as np
init_net = mynet.init_net
predict_net = mynet.predict_net
# you must name it something
predict_net.name = "squeezenet_predict"
# Dummy batch
data = np.random.rand(1, 3, 227, 227)
workspace.FeedBlob("data", data)
workspace.RunNetOnce(init_net)
workspace.CreateNet(predict_net)
p = workspace.Predictor(init_net.SerializeToString(), predict_net.SerializeToString())