Skip to content

Instantly share code, notes, and snippets.

View wellflat's full-sized avatar

ryohei tanaka wellflat

View GitHub Profile
wellflat /
Created September 5, 2022 01:37
Random sampling image files for torchvision.datasets.ImageFolder
#!/usr/bin/env python
import glob
import random
import shutil
import math
def random_sample_file(input_dir: str, output_dir: str, sample_ratio: float=0.05):
print(f'copy {input_dir} to {output_dir}')
wellflat / HelloONNX.vue
Last active January 29, 2024 09:01
Image Classification using ONNX Runtime for Web (ORT Web)
<div class="hello">
<h1>{{ msg }}</h1>
<canvas width="32" height="32" ref="canvas"></canvas>
<button type="button" @click="inference">inference</button>
<span>{{ infoLabel }}</span>
<script lang="ts">
wellflat /
Last active August 12, 2020 06:50
AWS S3 multipart upload sample
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import botocore
from boto3.session import Session
from boto3.s3.transfer import TransferConfig
from pprint import pprint
class S3Client(object):
wellflat / pyvips.ipynb
Last active January 22, 2018 14:15
libvipsで高速省メモリな画像処理 part1
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
wellflat / image_loader.js
Created November 27, 2017 13:04
promise image loader
let loadImage = ({ src }) => {
return new Promise((resolve, reject) => {
let img = new Image();
img.onload = () => {
img.src = src;
#include <iostream>
#include <faiss/IndexFlat.h>
#include <faiss/IndexIVFPQ.h>
#include <faiss/gpu/GpuIndexFlat.h>
#include <faiss/gpu/GpuIndexIVFPQ.h>
#include <faiss/gpu/StandardGpuResources.h>
#include <faiss/index_io.h>
#include <faiss/utils.h>
#include <boost/program_options.hpp>
wellflat /
Last active May 28, 2018 02:57
Emacs Memo



M-x describe-face


M-x list-faces-display
wellflat /
Created August 21, 2016 07:22
read smaps file (Linuxプロセスのメモリ共有率を計算)
#!/usr/bin/env python
import sys
def read_smaps(pidlist):
mem = lambda t, f: int(f[1]) if f[0] == '%s:' % t else 0.0
for pid in pidlist:
filename = "/proc/%s/smaps" % pid