TinaCristal's Blog


  • Home

  • Tags

  • Categories

  • Archives

  • Search

L1-判断字符串是否没有重复字符

Posted on 2018-05-25

实现一个算法确定字符串中的字符是否均唯一出现

样例
给出”abc”,返回 true

给出”aab”,返回 false

法一

两层for循环 遍历后面的字符串

Read more »

L1-二叉树的最小深度

Posted on 2018-05-25

题目描述

给定一个二叉树,找出其最小深度。

二叉树的最小深度为根节点到最近叶子节点的距离。
样例
给出一棵如下的二叉树:

    1
 /     \ 
2       3
      /    \
     4      5  

这个二叉树的最小深度为 2

Read more »

基于caffe的表情识别

Posted on 2018-05-23 | In caffe

跟着别人的博客跑了遍流程,准确率0.61,不算很好,但是也是大概跑个流程,感觉开心的表情识别较好,感觉调参这块还是得自己多实践。

数据集

采用的数据集是fer2013人脸表情数据集。fer2013,即Kaggle facial expression recognition challenge dataset,是目前较大的人脸表情识别公开数据库。

Read more »

ImportError: No module named caffe

Posted on 2018-05-23 | In 环境安装配置

在成功编译caffe的源码之后,可以在python环境中使用caffe。在Ubuntu环境下,打开python解释程序,输入import caffe时,可能会出现 ImportError: No module named caffe

import caffe
Traceback (most recent call last):
File ““, line 1, in
ImportError: No module named caffe

Read more »

Ubuntu上Caffe的安装及配置

Posted on 2018-05-23 | In 环境安装配置

1.安装依赖项

1
2
3
4
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
sudo apt-get install --no-install-recommends libboost-all-dev
sudo apt-get install libopenblas-dev liblapack-dev libatlas-base-dev
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
Read more »

L1-链表划分

Posted on 2018-05-23 | In LintCode

给定一个单链表和数值x,划分链表使得所有小于x的节点排在大于等于x的节点之前。

你应该保留两部分内链表节点原有的相对顺序。

示例:

给定链表 1->4->3->2->5->2->null,并且 x=3

返回 1->2->2->4->3->5->null

Read more »

L1-二叉树的最大深度

Posted on 2018-05-23 | In LintCode

给定一个二叉树,找出其最大深度。

二叉树的深度为根节点到最远叶子节点的距离。

样例
给出一棵如下的二叉树:

1
/ \
2 3
/ \
4 5
这个二叉树的最大深度为3.

二叉树的题目,大部分都能用分治的思路来解题。

Read more »

caffe可视化总结

Posted on 2018-05-22 | In caffe

有时候无法直接观察和查看多层网络,可视化是一个很重要的方法

数据可视化

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import numpy as np
import struct
import matplotlib.pyplot as plt
import Image

filename = 't10k-images-idx3-ubyte'
binfile = open(filename, 'rb')
buf = binfile.read()

index = 0
magic, numImages, numRows, numColumns = struct.unpack_from('>IIII', buf, index)
index += struct.calcsize('>IIII')

for image in range(0, numImages):
im = struct.unpack_from('>784B', buf, index)
index += struct.calcsize('>784B')

im = np.array(im, dtype='uint8')
im = im.reshape(28, 28)

im = Image.fromarray(im)
im.save('data/mnist/mnist_train/train_%s.bmp' % image, 'bmp')


Read more »

caffe的solver文件配置

Posted on 2018-05-22 | In caffe

假设我们有50000个训练样本,batch_size为64,即每批次处理64个样本,那么需要迭代50000/64=782次才处理完一次全部的样本。我们把处理完一次所有的样本,称之为一代,即epoch。所以,这里的test_interval设置为782,即处理完一次所有的训练数据后,才去进行测试。如果我们想训练100代,则需要设置max_iter为78200.

Read more »

caffe可视化绘制网络结构图

Posted on 2018-05-22 | In caffe

首先我们要知道caffe自带了根据模型prototxt文件作图的python文件,位于$caffe/python文件夹下的draw_net,py文件。执行网络结构可视化之前调用该文件就可以了。具体命令如下:

$cd caffe/python

$python draw_net.py ../models/bvlc_reference_caffenet/train_val.prototxt caffenet.png #caffenet结构图

$python draw_net.py ../models/bvlc_alexnet/train_val.prototxt alexnet.png #alexnet结构图

Read more »

1…373839…45

TinaCristal

443 posts
57 categories
55 tags
GitHub E-Mail
© 2020 TinaCristal
Powered by Hexo
|
Theme — NexT.Mist v5.1.4