Skip to content

Instantly share code, notes, and snippets.

View RomainMaillot13's full-sized avatar

Romain MAILLOT RomainMaillot13

  • Lyon
View GitHub Profile
<html>
<body>
<!-- Load TensorFlow.js -->
<script src="https://unpkg.com/@tensorflow/tfjs"></script>
<!-- Load Posenet -->
<script src="https://unpkg.com/@tensorflow-models/posenet">
</script>
<script type="text/javascript">
posenet.load().then(function(net) {
// posenet model loaded
@RomainMaillot13
RomainMaillot13 / Library
Created November 1, 2018 11:20
Install library for body recognition
<html>
<body>
<!-- Load TensorFlow.js -->
<script src="https://unpkg.com/@tensorflow/tfjs"></script>
<!-- Load Posenet -->
<script src="https://unpkg.com/@tensorflow-models/posenet">
</script>
<script type="text/javascript">
posenet.load().then(function(net) {
// posenet model loaded
@RomainMaillot13
RomainMaillot13 / Video detection
Created November 2, 2018 11:01
Video detection
let classifier;
let video;
function setup() {
noCanvas();
// Create a camera input
video = createCapture(VIDEO);
// Initialize the Image Classifier method with MobileNet and the video as the second argument
classifier = ml5.imageClassifier('MobileNet', video, modelReady);
}
@RomainMaillot13
RomainMaillot13 / dataset
Created November 2, 2018 11:17
dataset
idenprof//train//Lila// 900 images of Lila
idenprof//train//Marc// 900 images of Marc
idenprof//train//Rob// 900 images of Rob
idenprof//test//Lila// 200 images of Lila
idenprof//test//Marc// 200 images of Marc
idenprof//test//Rob// 200 images of Rob
@RomainMaillot13
RomainMaillot13 / Algorithm one person
Created November 2, 2018 13:28
Algorithm one person
const imageScaleFactor = 0.50;
const flipHorizontal = false;
const outputStride = 16;
const imageElement = document.getElementById('cat');
// load the posenet model
const net = await posenet.load();
const pose = await net.estimateSinglePose(imageElement, scaleFactor, flipHorizontal, outputStride);
@RomainMaillot13
RomainMaillot13 / Algorithm several persons
Created November 2, 2018 13:31
Algorithm several persons
const imageScaleFactor = 0.50;
const flipHorizontal = false;
const outputStride = 16;
// get up to 5 poses
const maxPoseDetections = 5;
// minimum confidence of the root part of a pose
const scoreThreshold = 0.5;
// minimum distance in pixels between the root parts of poses
const nmsRadius = 20;
const imageElement = document.getElementById('cat');
@RomainMaillot13
RomainMaillot13 / facebook login
Created November 27, 2018 09:48
facebook login
// Add this to the header of your file, e.g. in ViewController.m
// after #import "ViewController.h"
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
// Add this to the body
@implementation ViewController
- (void)viewDidLoad {
@RomainMaillot13
RomainMaillot13 / api messenger
Created November 27, 2018 10:07
api messenger
"messaging_type": "<MESSAGING_TYPE>",
"recipient":{
"id":"<PSID>"
},
"message":{
"text":"hello, world!"
}
@RomainMaillot13
RomainMaillot13 / get location
Created November 27, 2018 10:13
get location
<script>
function maPosition(position) {
var infopos = "Position déterminée :\n";
infopos += "Latitude : "+position.coords.latitude +"\n";
infopos += "Longitude: "+position.coords.longitude+"\n";
infopos += "Altitude : "+position.coords.altitude +"\n";
document.getElementById("infoposition").innerHTML = infopos;
}
if(navigator.geolocation)
@RomainMaillot13
RomainMaillot13 / connect to google map api
Created November 27, 2018 10:16
connect to google map api
function maPosition(position) {
var infopos = "Position déterminée :\n";
infopos += "Latitude : "+position.coords.latitude +"\n";
infopos += "Longitude: "+position.coords.longitude+"\n";
infopos += "Altitude : "+position.coords.altitude +"\n";
infopos += "Vitesse : "+position.coords.speed +"\n";
document.getElementById("infoposition").innerHTML = infopos;
// Un nouvel objet LatLng pour Google Maps avec les paramètres de position