start new:
tmux
start new with session name:
tmux new -s myname
import json | |
import os | |
import time | |
import requests | |
from PIL import Image | |
from StringIO import StringIO | |
from requests.exceptions import ConnectionError | |
def go(query, path): | |
"""Download full size images from Google image search. |
import sys, cv2 | |
# Refactored https://realpython.com/blog/python/face-recognition-with-python/ | |
def cascade_detect(cascade, image): | |
gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) | |
return cascade.detectMultiScale( | |
gray_image, | |
scaleFactor = 1.15, | |
minNeighbors = 5, |
# install dependencies | |
sudo apt-get update | |
sudo apt-get install -y build-essential | |
sudo apt-get install -y cmake | |
sudo apt-get install -y libgtk2.0-dev | |
sudo apt-get install -y pkg-config | |
sudo apt-get install -y python-numpy python-dev | |
sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev | |
sudo apt-get install -y libjpeg-dev libpng-dev libtiff-dev libjasper-dev | |
""" | |
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) | |
BSD License | |
""" | |
import numpy as np | |
# data I/O | |
data = open('input.txt', 'r').read() # should be simple plain text file | |
chars = list(set(data)) | |
data_size, vocab_size = len(data), len(chars) |
import urllib, StringIO | |
from math import log, exp, tan, atan, pi, ceil | |
from PIL import Image | |
EARTH_RADIUS = 6378137 | |
EQUATOR_CIRCUMFERENCE = 2 * pi * EARTH_RADIUS | |
INITIAL_RESOLUTION = EQUATOR_CIRCUMFERENCE / 256.0 | |
ORIGIN_SHIFT = EQUATOR_CIRCUMFERENCE / 2.0 | |
def latlontopixels(lat, lon, zoom): |
'''This script goes along the blog post | |
"Building powerful image classification models using very little data" | |
from blog.keras.io. | |
It uses data that can be downloaded at: | |
https://www.kaggle.com/c/dogs-vs-cats/data | |
In our setup, we: | |
- created a data/ folder | |
- created train/ and validation/ subfolders inside data/ | |
- created cats/ and dogs/ subfolders inside train/ and validation/ | |
- put the cat pictures index 0-999 in data/train/cats |
from bs4 import BeautifulSoup | |
import requests | |
import re | |
import urllib2 | |
import os | |
import argparse | |
import sys | |
import json | |
# adapted from http://stackoverflow.com/questions/20716842/python-download-images-from-google-image-search |
# -*- coding: utf-8 -*- | |
""" | |
Created on Mon Sep 23 23:16:44 2017 | |
@author: Marios Michailidis | |
This is an example that performs stacking to improve mean squared error | |
This examples uses 2 bases learners (a linear regression and a random forest) | |
and linear regression (again) as a meta learner to achieve the best score. | |
The initial train data are split in 2 halves to commence the stacking. |
def unet(input_shape): | |
''' | |
Params: input_shape -- the shape of the images that are input to the model | |
in the form (width_or_height, width_or_height, | |
num_color_channels) | |
Returns: model -- a model that has been defined, but not yet compiled. | |
The model is an implementation of the Unet paper | |
(https://arxiv.org/pdf/1505.04597.pdf) and comes | |
from this repo https://github.com/zhixuhao/unet. It has |