Instructions WIP
Tested on Ubuntu 18.04.
Follow instructions from here.
| import argparse | |
| import json | |
| import time | |
| from pathlib import Path | |
| import shutil | |
| from typing import Optional | |
| import toml |
| import skimage | |
| import skimage.io | |
| import numpy as np | |
| from kitnn.models import minc | |
| import toolbox.images | |
| mincnet = minc.MincVGG() | |
| mincnet.load_npy('path/to/model.npy') | |
| mincnet = mincnet.cuda() |
Instructions WIP
Tested on Ubuntu 18.04.
Follow instructions from here.
| import math | |
| def normal(x, mu, sigma): | |
| return 1.0 / (sigma * math.sqrt(2*math.pi)) * torch.exp(-(x - mu)**2 / (2*sigma**2)) | |
| def continuous_histogram(batch, bins=32): | |
| hists = Variable(torch.zeros(batch.size(0), 3, bins).cuda()) | |
| binvals = Variable(torch.linspace(0, 1, bins).cuda()) | |
| # Expand values so we compute histogram in parallel. | |
| binvals = binvals.view(1, 1, 1, bins).expand(*batch.size(), bins) |
Get the prefix for the virtualenv directory and the main python installation. Note that the pyenv commands are somewhat misleading.
PREFIX_MAIN=`pyenv virtualenv-prefix`
PREFIX_VENV=`pyenv prefix`
Download opencv and opencv_contrib into a clean directory. Make a separate build directory in same directory as opencv and opencv_contrib and enter it.
| ______________________ _________________________ _________.___ | |
| \______ \_ _____/\ \ / /\_ _____/\______ \/ _____/| | | |
| | _/| __)_ \ / | __)_ | _/\_____ \ | | | |
| | | \| \ \ / | \ | | \/ \| | | |
| |____|_ /_______ / \___/ /_______ / |____|_ /_______ /|___| | |
| \/ \/ \/ \/ \/ | |
| [<<] K Park, 2008 (k@y.flixey.com) | |
| [<<] Visit http://flixey.com for more. | |
| [<<] GNU General Public License: |
| #!/usr/bin/python | |
| import urllib.parse | |
| import urllib.request | |
| import re | |
| import threading | |
| import json | |
| import pprint | |
| from datetime import datetime |