A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
# 0 is too far from ` ;) | |
set -g base-index 1 | |
# Automatically set window title | |
set-window-option -g automatic-rename on | |
set-option -g set-titles on | |
#set -g default-terminal screen-256color | |
set -g status-keys vi | |
set -g history-limit 10000 |
import os | |
import inspect | |
from functools import wraps | |
_file_cache = {} | |
def cache_file(path): | |
def cache_is_fresh(name): |
# Builds a Libpng framework for the iPhone and the iPhone Simulator. | |
# Creates a set of universal libraries that can be used on an iPhone and in the | |
# iPhone simulator. Then creates a pseudo-framework to make using libpng in Xcode | |
# less painful. | |
# | |
# To configure the script, define: | |
# IPHONE_SDKVERSION: iPhone SDK version (e.g. 8.1) | |
# | |
# Then go get the source tar.bz of the libpng you want to build, shove it in the | |
# same directory as this script, and run "./libpng.sh". Grab a cuppa. And voila. |
#include <QtGui> | |
#include <QGraphicsRectItem> | |
#include <QGraphicsView> | |
#include <QApplication> | |
#include <QGraphicsSceneMouseEvent> | |
class CustomItem : public QGraphicsEllipseItem | |
{ | |
protected: | |
void mousePressEvent(QGraphicsSceneMouseEvent *event) |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test | |
sudo apt-get update | |
sudo apt-get install gcc-5 g++-5 | |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5 |
# The train/test net protocol buffer definition | |
net: "examples/cifar10/cifar10_full_sigmoid_train_test.prototxt" | |
# test_iter specifies how many forward passes the test should carry out. | |
# In the case of CIFAR10, we have test batch size 100 and 100 test iterations, | |
# covering the full 10,000 testing images. | |
test_iter: 100 | |
# Carry out testing every 1000 training iterations. | |
test_interval: 1000 | |
# The base learning rate, momentum and the weight decay of the network. | |
base_lr: 0.001 |
# A yaml constructor is for loading from a yaml node. | |
# This is taken from @misha 's answer: http://stackoverflow.com/a/15942429 | |
def opencv_matrix_constructor(loader, node): | |
mapping = loader.construct_mapping(node, deep=True) | |
mat = np.array(mapping["data"]) | |
mat.resize(mapping["rows"], mapping["cols"]) | |
return mat | |
yaml.add_constructor(u"tag:yaml.org,2002:opencv-matrix", opencv_matrix_constructor) | |
# A yaml representer is for dumping structs into a yaml node. |
# coding: utf-8 | |
# A little demo illustrating the effect of momentum in neural network training. | |
# Try using different values for MOMENTUM constant below (e.g. compare 0.0 with 0.9). | |
# This neural network is actually more like logistic regression, but I have used | |
# squared error to make the error surface more interesting. | |
import numpy as np | |
import pylab |
This tutorial will guide through the steps to create a simple custom layer for Caffe using python. By the end of it, there are some examples of custom layers.
Usually you would create a custom layer to implement a funcionality that isn't available in Caffe, tuning it for your requirements.
Probably just Python and Caffe installed.