Skip to content

Instantly share code, notes, and snippets.

@juergenhoetzel
juergenhoetzel / getstarred.sh
Last active April 16, 2023 09:50
List starred Github repos in Shell (curl + jq)
user=juergenhoetzel
while curl -s "https://api.github.com/users/$user/starred?per_page=100&page=${page:-1}" \
|jq -r -e '.[].full_name' && [[ ${PIPESTATUS[1]} != 4 ]]; do
let page++
done
@chad-m
chad-m / streamlit_download_button.py
Last active April 1, 2024 02:28
A download function and examples app for Streamlit
import base64
import os
import json
import pickle
import uuid
import re
import streamlit as st
import pandas as pd
@yoonjechoi
yoonjechoi / Dockerfile
Created May 2, 2020 15:52
cuda + opencv + pytorch in ubuntu18.04
# ==================================================================
# module list
# ------------------------------------------------------------------
# darknet latest (git)
# torch latest (git)
# python 3.8 (apt)
# pytorch latest (pip)
# onnx latest (pip)
# theano latest (git)
# tensorflow latest (pip)
import streamlit as st
import os
import sys
import importlib.util
# Parse command-line arguments.
if len(sys.argv) > 1:
folder = os.path.abspath(sys.argv[1])
else:
folder = os.path.abspath(os.getcwd())
@ines
ines / streamlit_prodigy.py
Created October 3, 2019 20:37
Streamlit + Prodigy
"""
Example of a Streamlit app for an interactive Prodigy dataset viewer that also lets you
run simple training experiments for NER and text classification.
Requires the Prodigy annotation tool to be installed: https://prodi.gy
See here for details on Streamlit: https://streamlit.io.
"""
import streamlit as st
from prodigy.components.db import connect
from prodigy.models.ner import EntityRecognizer, merge_spans, guess_batch_size
@Saafke
Saafke / gsoc19_dnn_superres.md
Last active March 28, 2022 13:55
[GSoC '19] Learning-based Super-Resolution in OpenCV

Google Summer of Code 2019 with OpenCV

Learning-based Super Resolution

Student: Xavier Weber
Mentors: Vladimir Tyan & Yida Wang
Student on the same project: Fanny Monori

Link to accomplished work:

@pculliton
pculliton / oid_mask_encoding.py
Created July 11, 2019 22:14
Mask encoding example for Kaggle OpenImages Instance Segmentation Competition
import base64
import numpy as np
from pycocotools import _mask as coco_mask
import typing as t
import zlib
def encode_binary_mask(mask: np.ndarray) -> t.Text:
"""Converts a binary mask into OID challenge encoding ascii text."""
# check input mask --
if mask.dtype != np.bool:
@schiffty
schiffty / frames_to_TC.py
Last active July 27, 2021 06:00
Frames to Timecode in Python
def frames_to_TC (frames):
h = int(frames / 86400)
m = int(frames / 1440) % 60
s = int((frames % 1440)/24)
f = frames % 1440 % 24
return ( "%02d:%02d:%02d:%02d" % ( h, m, s, f))
# Breakdown of the steps above:
# Hours: Divide frames by 86400 (# of frames in an hour at 24fps). Round down to nearest integer.
@duhaime
duhaime / measure_img_similarity.py
Last active March 1, 2023 08:41
Compare image similarity in Python using Structural Similarity, Pixel Comparisons, Wasserstein Distance (Earth Mover's Distance), and SIFT
import warnings
from skimage.measure import compare_ssim
from skimage.transform import resize
from scipy.stats import wasserstein_distance
from scipy.misc import imsave
from scipy.ndimage import imread
import numpy as np
import cv2
##
@dayitv89
dayitv89 / rename.py
Last active April 2, 2018 02:09
Python script to rename all files in folder
import os
# convert all image like `<Any_name>_2x.png` to `<Any_name>@2x.png`
[os.rename(f, f.replace('_2x', '@2x')) for f in os.listdir('.') if not f.startswith('.')]