deep-organizer v1.0.3
deep media organizer with deep leraning (mobilenet-ssd)
This is a nodejs package to organize files like images and videos in folders with respective classes detected by a Tensorflow object detect model (converted from python to js).
Usage
const DeepOrganizer = require('@nindoo/deep-organizer').DeepOrganizer
const modelConfig = {
modelUrl: 'file://path/for/your/web_model/model.json',
classes: {
1: {
name: 'CNH_F',
id: 1,
displayName: 'CNH_F'
},
2:{
name: 'CNH_Fv',
id: 2,
displayName: 'CNH_Fv'
}
}
}
const mediaPath = 'media/path/videos-or-images'
const organizer = new DeepOrganizer(modelConfig, mediaPath)
organizer.loadModel().then(async ()=>{
await organizer.organizeImagesTo(mediaPath)
await organizer.organizeVideosTo(mediaPath)
})modelConfig
const modelConfig = {
modelUrl: 'It MUST start with file:// for local files or https:// for remote files',
classes: 'It repesent your label_map.pbtxt from your tensorflow model'
}Technical details for advanced users
This model is based on the TensorFlow object detection API. You can download the original models from here. We applied the following optimizations to improve the performance for browser execution:
Install the TensorFlow.js pip package:
pip install tensorflowjsRun the converter script provided by the pip package:
The converter expects a TensorFlow SavedModel, TensorFlow Hub module, TensorFlow.js JSON format, Keras HDF5 model, or tf.keras SavedModel for input.
TensorFlow SavedModel example:
tensorflowjs_converter \
--input_format=tf_saved_model \
--output_format=tfjs_graph_model \
--signature_name=serving_default \
--saved_model_tags=serve \
/mobilenet/saved_model \
/mobilenet/web_model Tensorflow Hub module example:
tensorflowjs_converter \
--input_format=tf_hub \
'https://tfhub.dev/google/imagenet/mobilenet_v1_100_224/classification/1' \
/mobilenet/web_model Keras HDF5 model example:
tensorflowjs_converter \
--input_format=keras \
/tmp/my_keras_model.h5 \
/tmp/my_tfjs_modeltf.keras SavedModel example:
tensorflowjs_converter \
--input_format=keras_saved_model \
/tmp/my_tf_keras_saved_model/1542211770 \
/tmp/my_tfjs_modelmore information about convertion here