GithubHelp home page GithubHelp logo

josslei / obj-detect_demo_2020-2021_cpp-process Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 30 KB

VGG16 resolving server written in C++, planned to be a child process of a Node.js main GUI process

License: GNU General Public License v3.0

C++ 100.00%

obj-detect_demo_2020-2021_cpp-process's Introduction

Chinese Academy of Science Project Demonstration - Invoking of TorchScript module

This is a program that could give classification prediction by invoking a given trained TorchScript module. Planned to run as an independent process, which will only load the module once.

Now it is fit for Node.js program to load as a child process, communicate with reading/writing its standard output/input.


Compile Environment

Library Architecture Version
LibTorch x64 for CPU 1.7.1
jsoncpp x64 1.9.4

Usage

Create as a child process

var child_process = require('child_process');
var child = child_process.spawn('./invoke.exe', ['./assets/module.pt']); 

Read from stdout of the child process

child.stdout.on('data', function (data) {
    console.log(data.toString());
});

Write to stdin of the child process

child.stdin.write("Msg from Node.js!\n");
child.stdin.write("Msg2 from Node.js!\n");

Communicate Protocol

Use Json to communicate. Every thing sended or received is Json format string.

To send a Json string stream to the invoking process, the stream should not contain MORE THAN ONE line break ('\n'). You should have ONE AND ONLY ONE '\n' at the end of the message in order to flush the stream correctly.

The format should be restricted like this:

{
    "type" : "XXX",
    "data" : "XXX"
}

"XXX" means the value you're trying to send.

The value of "data" is not restricted to any specific type. It could also be an array, etc..

Of course, the Json stream should be like this when sending the message:

{ "type" : "XXX", "data" : "XXX" }

obj-detect_demo_2020-2021_cpp-process's People

Contributors

josslei avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.