This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# This script installs leptonica and tesseract from source | |
# it does not install other pre-requisites to a custom location. | |
# side note: install prefix is defined once per library. | |
# side note: it clones git repositories in the current directory. | |
set -e | |
set -u |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this is a quick ipython script to download all pre-trained pytorch models. | |
# run like this: | |
# ipython THIS_SCRIPT.ipy | |
import torchvision as tv, types, os.path | |
# get list of urls ... in a brittle way. | |
x = {k: v for dct in [getattr(y, 'model_urls') for y in (getattr(tv.models, x) for x in dir(tv.models)) if isinstance(y, types.ModuleType)] for k, v in dct.items()} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
PyTorch Guided Filter for multi-channel (color) guide image and 1 channel | |
(grayscale) source image | |
""" | |
import torch as T | |
import torch.nn as nn | |
def box_filter_1d(tensor, dim, r): | |
cs = tensor.cumsum(dim).transpose(dim, 0) |
OlderNewer