这是一个测试,用于演示使用iPython NoteBook进行代码运行和说明。很适合Python的教学辅助。
原始路径 点我访问
这里应该是支持Latex的,测试一下吧:\(A(x)=sum^1_n(x)\), Perfect!
至于颜色,我想应该可以支持html代码,似乎还支持CSS,试试:这里是红色加粗18px号字体! navyBlue 海蓝色?下面是Caffe的例子代码片段!
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
# Make sure that caffe is on the python path:
caffe_root = '/home/ouxinyu/caffe-master/' # this file is expected to be in {caffe_root}/examples
import sys
sys.path.insert(0, caffe_root + 'python')
import caffe
# Set the right path to your model definition file, pretrained model weights,
# and the image you would like to classify.
MODEL_FILE = 'models/bvlc_reference_caffenet/deploy.prototxt'
PRETRAINED = 'models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel'
IMAGE_FILE = 'examples/images/cat.jpg'
import os
if not os.path.isfile(PRETRAINED):
print("Downloading pre-trained CaffeNet model...")
!scripts/download_model_binary.py models/bvlc_reference_caffenet
这一步,要注意的是修改原始案例中的一些地址路径,还有下载caffemodel之类的。
caffe.set_mode_cpu()
net = caffe.Classifier(MODEL_FILE, PRETRAINED,
mean=np.load(caffe_root + 'python/caffe/imagenet/ilsvrc_2012_mean.npy').mean(1).mean(1),
channel_swap=(2,1,0),
raw_scale=255,
image_dims=(256, 256))
input_image = caffe.io.load_image(IMAGE_FILE)
plt.imshow(input_image)
好啦,显示出图片啦,演示就此结束。