Skip to content

Instantly share code, notes, and snippets.

View piercus's full-sized avatar

Colle piercus

  • Finegrain.ai
  • Paris
View GitHub Profile
@piercus
piercus / discrepancy_study.py
Last active February 21, 2024 11:22
Study batch discrepancy
from re import S
from numpy import c_
from torch.nn import Conv2d
import torch
from refiners import fluxion
from refiners.fluxion import manual_seed
from refiners.foundationals.latent_diffusion.stable_diffusion_1.unet import DownBlocks
from torch import Tensor, no_grad
from datasets import load_dataset, DownloadManager, Image
from sklearn.neighbors import NearestNeighbors
import pandas as pd
from PIL import Image
import numpy as np
from sklearn.metrics import ndcg_score
import time
from joblib import Parallel, delayed
import warnings
import torch
import torch.nn.functional as F
import numpy as np
from mmcls.models.losses import Accuracy
from mmcls.models.builder import HEADS, build_loss, build_head
from mmcls.models.utils import is_tracing
const fs = require('fs')
const folder = 'tmp/urbansoccer-tracks/'
const filename = folder + '1616079689177-person-7b4a5-0-92.316992.multiview-track';
const obj = JSON.parse(fs.readFileSync(filename));
console.log(`# Track name : ${obj.trackId} (${obj.trackCategory})`)
console.log(`\n## Cam 1 screen positions : (csv format)\n`)
console.log('frameIndex,top,left,width,height')
// i'm using opencv4nodejs to load a file into a tensorflow tensor
const cv = require('opencv4nodejs');
const mat = cv.imread('./tmp/lenna.png')
const size = {w: mat.cols, h: mat.rows}
const mat3 = new cv.Mat(rect.h, rect.w, cv.CV_8UC3);
mat.getRegion(new cv.Rect(rect.x, rect.y, rect.w, rect.h)).copyTo(mat3)
const cv = require('opencv4nodejs')
const tf = require('@tensorflow/tfjs-node');
const h = require('hasard')
const mat = cv.imread('./tmp/lenna.png')
const rect = {
x: 0,
y: 0,
w: 400,
h: 512
@piercus
piercus / wav_lowpass_example.py
Created March 12, 2016 22:06
python lowpass example
import matplotlib.pyplot as plt
import numpy as np
import wave
import sys
import math
import contextlib
fname = 'test.wav'
outname = 'filtered.wav'
@piercus
piercus / sand2require.js
Last active December 11, 2015 10:58
Script to use sand.define's modules with requirejs
if (typeof(define) === "undefined"){
console.log("[ERROR] require.js is not defined");
}
if (typeof(sand) !== "undefined"){
console.log("[ERROR] sand is already defined");
}
var sand;
(function(){
Array.prototype.last = String.prototype.last = function() {
return this[this.length - 1];