Skip to content

Instantly share code, notes, and snippets.

@alx
Last active June 21, 2018 07:40
Show Gist options
  • Save alx/18eb66ad75f77a2461e559a20aa2b204 to your computer and use it in GitHub Desktop.
Save alx/18eb66ad75f77a2461e559a20aa2b204 to your computer and use it in GitHub Desktop.
Use deepdetect-js to predict detection_600 classes from online webcam images
var fs = require('fs');
var moment = require('moment');
var DD = require('deepdetect-js');
const dd = new DD({
host: 'localhost',
port: 18104,
path: '/api/private/predict'
})
const urls = [
//'http://212.170.22.153:8080/jpg/image.jpg',
//'http://oviso.axiscam.net/axis-cgi/jpg/image.cgi',
//'http://mehamn.axiscam.net/jpg/image.jpg',
//'http://194.103.218.15/jpg/image.jpg?time=1529449195253&dummy=image.jpg',
//'https://static.earthcam.com/hof/england/abbeyroad/external/med/15294455093682_64_med.jpg',
'http://ludington.axiscam.net:5700/axis-cgi/jpg/image.cgi',
]
const postData = {
"service": "download",
"parameters": {
"output": {
"confidence_threshold": 0.1,
"bbox": true
},
"mllib": {
"gpu": true
}
},
"data": urls
}
TRIGGERS = {
classes: {
count: 1
}
}
async function run() {
const predict = await dd.postPredict(postData);
predict.body.predictions.forEach( prediction => {
if(prediction.classes.length >= TRIGGERS.classes.count) {
fs.writeFileSync(`./json/${moment().format()}.json`, JSON.stringify(prediction));
}
});
}
run();
setInterval(run , 60000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment