docker下使用caffe的命令记录

  • 查看所有的images
sudo docker images

  • 利用某个image生成container
    sudo docker run -it --net=host -v /home/tingting/Dropbox/code/craterDetection/docker:/root/workspace tingting/caffe:version1 bash

  • 打开jupyter notebook

jupyter notebook

在浏览器中输入:localhost:8890

这里一定要注意,有时因为打开多个containers,新的container的jupyter notebook的接口是不同的,之前因为以为所有的接口窦唯8888,所以直接输入了8888,但其实这样打开的是8888那个接口对应的container

  • 将prototxt文件生成网络结构图
 1 # Load the module
 2 import caffe
 3 import caffe.draw
 4 from caffe.proto import caffe_pb2
 5 from google.protobuf import text_format
 6 
 7 # Set the parameters
 8 netName = 'test_net'
 9 
10 input_net_proto_file = netName + '.prototxt'
11 output_image_file =  netName + '.jpg'
12 rankdir ='LR'
13 
14 '''
15 # net configuration file
16 input_net_proto_file = 'test_net.prototxt' 
17 # output configuration image file name
18 output_image_file ='test_net.jpg' 
19 # net arrange method, which is in ['LR'、'TB'、'RL']
20 rankdir ='LR' 
21 '''
22 
23 # Read the net
24 net = caffe_pb2.NetParameter()
25 text_format.Merge(open(input_net_proto_file).read(), net)
26 
27 # Draw the net
28 print('Drawing net to %s' % output_image_file)
29 caffe.draw.draw_net_to_file(net, output_image_file, rankdir)
30 print('done...') 
  •  利用一个新的terminal打开正在运行的container

# watch the containers which are running

sudo dockers ps

# go into one conainer

sudo docker exec -it sharp_ardinghelli bash

原文地址:https://www.cnblogs.com/lutingting/p/5237158.html