Skip to content

Instantly share code, notes, and snippets.

@John1231983
John1231983 / fcn-8s
Created February 8, 2017 06:48
fcn-8s
# data layers
layer {
name: "data"
type: "Data"
top: "data"
include {
phase: TRAIN
}
data_param {
batch_size: 1
# data layers
layer {
name: "data"
type: "Data"
top: "data"
include {
phase: TRAIN
}
data_param {
batch_size: 1
Collecting chainer
1 location(s) to search for versions of chainer:
* https://pypi.python.org/simple/chainer/
Getting page https://pypi.python.org/simple/chainer/
Starting new HTTPS connection (1): pypi.python.org
"GET /simple/chainer/ HTTP/1.1" 200 3108
Analyzing links from page https://pypi.python.org/simple/chainer/
Found link https://pypi.python.org/packages/00/54/05ed3a024a4ec9ac2f227d71cbae867d4e7820f563f7e6ce2f1efd4db4ed/chainer-1.6.0.tar.gz#md5=08f0d2a0b1f7c2913c75c3d73058c39a (from https://pypi.python.org/simple/chainer/), version: 1.6.0
Found link https://pypi.python.org/packages/11/3f/78e4fcfa11dbe240d958f20510bfae6a7fb94f00e8ea7f5e12136cb6133b/chainer-1.10.0.tar.gz#md5=79658efdb604d44a2a64d2a8b099584e (from https://pypi.python.org/simple/chainer/), version: 1.10.0
Found link https://pypi.python.org/packages/12/b9/7926fb395a1af409ca4730387cd8d729e24dfe0e7e150c21c138b9f2bf2d/chainer-1.19.0.tar.gz#md5=f7788c953a3fe0fee5bdb2af1d01d23b (from https://pypi.python.org/simple/chaine
name: "ResNet-50"
input: "data"
input_dim: 1
input_dim: 3
input_dim: 224
input_dim: 224
layer {
bottom: "data"
top: "conv1"
'''
Target: evaluate your trained caffe model with the medical images. I use simpleITK to read medical images (hdr, nii, nii.gz, mha and so on)
Created on Oct. 20, 2016
Author: Dong Nie
Note, this is specified for the prostate, which input is larger than output
'''
# Simple single-layer network to showcase editing model parameters.
name: "InfantNet"
input: "dataMR32"
input_shape {
dim: 1
dim: 1
dim: 32
dim: 32
dim: 32
}
from __future__ import print_function
import pandas as pd
import h5py
import nibabel as nib
import numpy as np
def load_nifti(filename, with_affine=False):
img = nib.load(filename)
data = img.get_data()
data = np.squeeze(data)
layer {
name: "data"
type: "HDF5Data"
top: "data"
top: "label"
include {
phase: TRAIN
}
hdf5_data_param {
source: "./trainMS_list.txt"
caffe_root = './caffe/'
import sys
sys.path.insert(0, caffe_root + 'python')
import caffe
from caffe import layers as L, params as P
from caffe.coord_map import crop
def conv_relu(bottom, nout, ks=3, stride=1, pad=1):
conv = L.Convolution(bottom, kernel_size=ks, stride=stride, engine=1,
num_output=nout, pad=pad, weight_filler=dict(type='xavier'),bias_filler=dict(type='constant', value=0)
#include <algorithm>
#include <vector>
#include "caffe/layers/batch_renorm_layer.hpp"
#include "caffe/util/math_functions.hpp"
namespace caffe {
template <typename Dtype>
void BatchReNormLayer<Dtype>::LayerSetUp(const vector<Blob<Dtype>*>& bottom,