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

https://lddpicture.oss-cn-beijing.aliyuncs.com/picture/image-20191208094933945.png

https://lddpicture.oss-cn-beijing.aliyuncs.com/picture/image-20191208095158661.png

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 images > places recognition download
AN4: 948 training and 130 test utterances speech download
BSDS (300/500): 12k labeled segmentations image segmentation download images download segmentations
Celeb-A: 200k+ celebrity images, 10k+ identities celebrity images download
CIFAR-10: 60k tiny (32x32) tagged images tiny images download
COCO: A large image dataset designed for object detection, segmentation, and caption generation. coco download
CompCars: 136k+ car images & 1716 car models cars download
Oxford 102 Flowers: 102 flower categories flowers download images download segmentations
ImageNet: 14,197,122 images, 21841 synsets indexed large range of images download
ImageNet ILSVRC: Competition datasets large range of images download
Iris flowers > classification download
LSUN Scenes millions of indoor/outdoor building scenes scene classification download
LSUN Room Layout 4000 indoor scenes scene classification download
MNIST 60k handwriting training set, 10k test images handwriting download
Multi-Salient-Object (MSO) 1224 tagged salient object images tagged objects download
OUI-Adience Face Image 26,580 age & gender labeled images age, gender download
PASCAL VOC 2012 11,530 images w/ 27,450 ROI annotated objects and 6,929 segmentations images > object recognition download
PCAP Network captures of regular internet traffic and attack scenario traffic network capture download
Penn Treebank (PTB) statistical language modeling language download
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 video > action download
UCI Datasets variety download
US Census: demographic data line graph download
VGG-Face millions of faces faces download
LibriSpeech 1000 hours free speech recognition traning dataset language download

Downloading and Importing Caffe2 Models

  • simpe predictions:
    1. a protobuf that defines the network
    2. 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())
0%