This file contains hidden or 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
# https://gis.cdc.gov/grasp/covidnet/COVID19_5.html | |
# 2020-21 | |
import ubelt as ub | |
US_POP_APPROX = 330e6 | |
SAMPLE_SIZE = US_POP_APPROX * 0.1 | |
print(SAMPLE_SIZE) | |
# NOTE: These are lab-verified COVID numbers. The sample size is 190509. This | |
# represents about 10% of the US population. This chart says total observed |
This file contains hidden or 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
def lazy_install(module_name, submodules, submod_attrs): | |
""" | |
Defines gettr for lazy import via PEP 562 | |
https://www.python.org/dev/peps/pep-0562/ | |
""" | |
import sys | |
import importlib | |
import importlib.util | |
all_funcs = [] | |
for mod, funcs in submod_attrs.items(): |
This file contains hidden or 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
""" | |
Experiment Script Related to Pytorch Memory Leak Issue | |
References: | |
https://github.com/pytorch/pytorch/issues/13246 | |
https://gist.github.com/mprostock/2850f3cd465155689052f0fa3a177a50 | |
""" | |
from torch.utils.data import Dataset, DataLoader | |
import numpy as np | |
import torch |
This file contains hidden or 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
(py36) joncrall@Ooo:~/code/netharn$ python setup.py build | |
-------------------------------------------------------------------------------- | |
-- Trying "Ninja" generator | |
-------------------------------- | |
--------------------------- | |
---------------------- | |
----------------- | |
------------ |
This file contains hidden or 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
(py36) joncrall@Ooo:~/code/netharn$ ./setup.py clean && pip install -e . | |
Deleting directory="./__pycache__" | |
Deleting directory="./_skbuild" | |
Not deleting non-existant path="./__pycache__/skbuild_pr.cpython-36.pyc" | |
Obtaining file:///home/joncrall/code/netharn | |
Installing build dependencies ... done | |
Getting requirements to build wheel ... done | |
Preparing wheel metadata ... done | |
Requirement already satisfied: torch in /home/joncrall/.local/conda/envs/py36/lib/python3.6/site-packages (from netharn==0.1.8.dev0) (1.0.0) | |
Requirement already satisfied: tqdm in /home/joncrall/.local/conda/envs/py36/lib/python3.6/site-packages (from netharn==0.1.8.dev0) (4.23.4) |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
""" | |
This module can be used as both a script and an importable module. | |
Run `python ggr_matching.py --help` for more details. | |
See docstring in fit for more details on the importable module. | |
conda install opencv | |
conda install pytorch torchvision -c pytorch |
This file contains hidden or 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
__heredoc__(){ NOOP=; } | |
has_pymodule(){ | |
__heredoc__ ''' | |
Check if a python module is installed. Echos "True" or "False" to the | |
command line depending on the result. | |
Example: | |
source $HOME/local/init/utils.sh |
This file contains hidden or 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
import scipy | |
import scipy.ndimage | |
import numpy as np | |
import ubelt as ub | |
def g(f, s, **kw): | |
""" | |
Apply a gaussian filter to an input signal |
This file contains hidden or 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
def benchmark_pandas(): | |
import timerit | |
import pandas as pd | |
import numpy as np | |
column_data = { | |
key: np.random.rand(1000) | |
for key in map(chr, range(ord('a'), ord('z'))) | |
} |
This file contains hidden or 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
Timer unit: 1e-06 s | |
Pystone time: 0.026254 s | |
File: /home/joncrall/code/netharn/netharn/models/yolo2/light_region_loss.py | |
Function: _build_targets_tensor at line 382 | |
Line # Hits Time Per Hit % Time Line Contents | |
============================================================== | |
382 @profiler.profile |