Skip to content

Instantly share code, notes, and snippets.

View Makio64's full-sized avatar

Makio64 Makio64

View GitHub Profile
@Makio64
Makio64 / ExportYoloV8ToTFJS.md
Last active May 9, 2024 14:29
Export YoloV8 for TFJS with TensorFlow 2.13.1 compile from source on macOS M3

Export YoloV8 for TFJS with TensorFlow 2.13.1 on macOS M3

The Problem

TensorFlow SavedModel: starting export with tensorflow 2.16.1...
WARNING ⚠️ tensorflow<=2.13.1 is required, but tensorflow==2.16.1 is currently installed https://github.com/ultralytics/ultralytics/issues/5161
  • Compiling yolov8 requires TensorFlow 2.13.1, which is not available via pip install tensorflow==2.13.1.
  • We must compile this tensorflow version from the source, and its a very challenging task.
@Makio64
Makio64 / drawRectRounded.js
Created May 26, 2023 17:37
drawRectRounded with different radius in pixijs
export function drawRectRounded(graphics, x, y, width, height, topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius) {
// Starting from the top left corner.
graphics.moveTo(x + topLeftRadius, y)
// Drawing the top line with top right corner.
graphics.lineTo(x + width - topRightRadius, y)
graphics.quadraticCurveTo(x + width, y, x + width, y + topRightRadius)
// Drawing the right line with bottom right corner.
graphics.lineTo(x + width, y + height - bottomRightRadius)
@Makio64
Makio64 / convert.js
Last active May 28, 2022 03:16
Convert mp4 to dash and hls fragmented video in Nodejs
const path = require('path')
const fs = require('fs')
const util = require('util')
const exec = util.promisify(require('child_process').exec)
// https://www.bento4.com/downloads/
const BENTO4Folder = 'D:/Bento4-SDK-1-6-0-639.x86_64-microsoft-win32/bin'
const mp4dash = BENTO4Folder + '/mp4dash'
const mp4fragment = BENTO4Folder + '/mp4fragment'
@Makio64
Makio64 / getFilesDepth.js
Last active May 28, 2022 02:37
Node get all files until a certain directory depth
const path = require('path')
const fs = require('fs')
// adapted from https://techbrij.com/nodejs-traverse-directory-recursively-depth
function getFilesDepth (dirPath, maxDepth, currentDepth = 0, files = []) {
if (currentDepth <= maxDepth) {
fs.readdirSync(dirPath).forEach(function (file) {
const filepath = path.join(dirPath, file)
const stat = fs.statSync(filepath)
if (stat.isDirectory()) {
@Makio64
Makio64 / commands
Last active February 21, 2022 17:03
ffmpeg commands to convert images folder to video or gif
//---------------------------------------------------------------------------- EXPORT VIDEO
// convert a serie of images to high quality video
ffmpeg -f image2 -framerate 2 -i %d.png -vcodec libx264 -b 800k video.avi
// re-scale option to 1080x1080 ( for example )
ffmpeg -f image2 -framerate 2 -i %d.png -vf scale=1080x1080 video.avi
// convert for iphone format
ffmpeg -i video.avi -c:v libx264 -pix_fmt yuv420p -profile:v main -crf 1 -preset medium -c:a aac -movflags +faststart output.mp4
@Makio64
Makio64 / rollup.config.js
Created August 5, 2018 23:46
Rollup Config with : es6 ( Babel ) / Dynamic CodeSplitting / Stylus / Paths setup / LiveReload / Minifiers / esm export / ..
// ROLLUP CONFIG from @makio64
//-------------------------------------------------------------------------- PLUGINS
import includePaths from 'rollup-plugin-includepaths'
import rootImport from 'rollup-plugin-root-import'
import resolve from 'rollup-plugin-node-resolve'
import builtins from 'rollup-plugin-node-builtins'
import babel from 'rollup-plugin-babel'
import commonjs from 'rollup-plugin-commonjs'
@Makio64
Makio64 / gist:cc9fae0770ef56e6aaf756bfe5d8d871
Last active May 22, 2018 08:49
webworker from function and webworkerImageLoad
function createWorker(f) {
return new Worker(URL.createObjectURL(new Blob([`(${f})()`])));
}
//---------------------------------------------------------------------- CURL
vec4 permute(vec4 x){return mod(x*x*34.+x,289.);}
float snoise(vec3 v){
const vec2 C = 1./vec2(6,3);
const vec4 D = vec4(0,.5,1,2);
vec3 i = floor(v + dot(v, C.yyy));
vec3 x0 = v - i + dot(i, C.xxx);
@Makio64
Makio64 / Technical specification
Last active September 4, 2017 10:43
meta simple step
facebook.jpg : 1200x630
twitter.jpg : 512x512
generate icons : https://realfavicongenerator.net/
facebook validator : https://developers.facebook.com/tools/debug/
twitter validator : https://cards-dev.twitter.com/validator
Math.cross :
[a1, a2, a3] and B = [b1, b2, b3] is defined as:
cross(A, B) = [ a2 * b3 - a3 * b2, a3 * b1 - a1 * b3, a1 * b2 - a2 * b1 ]
for 3 points :
vNormal = normalize( cross(pos2.xyz-pos.xyz, pos3.xyz-pos.xyz) )