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 cv2 | |
import numpy as np | |
def warp_image_with_heatmap(src_image: 'BGRImageArray', heatmap: 'HeatMapArray') -> 'BGRImageArray': | |
""" Rough draft of warping an image with a heatmap. | |
We compute a set of "resampled pixel locations" and then use cv2.remap to resample the image from these points. | |
Think of heatmap as representing a grid of point masses. | |
Each heatmap point "pulls" each resampled-pixel-point away from its original location. |
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
from dataclasses import dataclass | |
from typing import Optional | |
import cv2 | |
import numpy as np | |
import tensorflow as tf | |
def tf_box_sum_image_from_padded_image(padded_image, width: int): |
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 tensorflow as tf | |
def tf_mask_to_boxes(mask, insert_fake_first_box: bool = False): | |
""" | |
Convert a boolean mask to a series of bounding boxes around each segment. | |
Warning: VERY SLOW (slower than pure python version of same algorithm) | |
:param mask: A (HxW) boolean mask |
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 hashlib | |
import itertools | |
import os | |
from collections import OrderedDict | |
from dataclasses import dataclass | |
from typing import Optional, TypeVar, Generic, Hashable, Any | |
from typing import Tuple, Iterator | |
import av | |
import cv2 |
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 shutil | |
import tempfile | |
from dataclasses import dataclass | |
from typing import Optional, Callable, Any, Mapping | |
import os | |
import numpy as np | |
import tensorflow as tf | |
def save_signatures_to_tflite_model( |
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
# Author: Peter O'Connor | |
# This script starts with a pyinstaller spec file, builds a macOS app, | |
# codesigns it, notarizes it, staples the notarization ticket, and zips it up. | |
# Full Guide at: https://sites.google.com/site/petesjunkyard/how-to-turn-your-python-program-into-a-working-macos-app | |
# | |
# Before using: | |
# 1) You should have a python app with a main script. | |
# 2) Become apple developer - See guide https://sites.google.com/site/petesjunkyard/how-to-turn-your-python-program-into-a-working-macos-app | |
# 3) Install pyinstaller with | |
# pip install pyinstaller |
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
# Python 3.11.7 Conda build with Tkinter 8.6.13 - Should fix MacOS Sonoma unresponsive-mouse-click issues. | |
# | |
# Modified from https://gist.github.com/space-medicine-lab/17ebe2dee2cc9c26c8907db85bfa220e | |
# | |
# | |
# This file may be used to create an environment using: | |
# $ conda create --name <env> --file <this file> | |
# platform: osx-arm64 | |
@EXPLICIT | |
https://repo.anaconda.com/pkgs/main/osx-arm64/blas-1.0-openblas.conda |
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
package com.eagleeyessearch | |
/** | |
* Mersenne Twister (MR19937) random number generator | |
* Translated from Numpy source code https://github.com/numpy/numpy/tree/main/numpy/random/src/mt19937 | |
* | |
* This class is designed to mimic the behavior of the numpy random number generator. I.e. when given | |
* the same seed, it should produce the same sequence of random numbers as numpy. | |
* | |
* val rng = NumpyLikeRandomState(intSeed) |
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
/** | |
* Vocal Coords Coordinate System | |
* | |
* This file is part of the Vocal Coords app — A free, offline, voice-enabled coordinate converter | |
* designed to reduce miscommunication of coordinates. The system encodes positions to roughly 2.4m (8ft) | |
* precision using a 12-token alphanumeric code with built-in error detection. | |
* | |
* For more details on how the system works, please visit: | |
* https://vocalcoords.com/about | |
* |
OlderNewer