intel / webml-polyfill

Deprecated, the Web Neural Network Polyfill project has been moved to https://github.com/webmachinelearning/webnn-polyfill
Apache License 2.0
161 stars 42 forks source link

Reduce file size of OpenCV.js when build the file with configs #1348

Closed ibelem closed 4 years ago

ibelem commented 4 years ago

The file size of OpenCV.js is 8.1MB (Wasm) and 9.0MB (Threads+SIMD) which is too huge, there should be some parameters to use to reduce the file size, we only need a deep learning module.

We could try to change

white_list = makeWhiteList([core, imgproc, objdetect, video, dnn, features2d, photo, aruco, calib3d])

to

white_list = makeWhiteList([core, dnn])

in

https://github.com/opencv/opencv/blob/master/platforms/js/opencv_js.config.py

then follow https://docs.opencv.org/4.3.0/d4/da1/tutorial_js_setup.html to build OpenCV.js.

Based on https://github.com/intel/webml-polyfill/pull/1326, @akineeic built the files with emscripten 1.39.15 and opencv 4.3.0.

@BruceDai or @miaobin please try it when you have time and compare the file sizes.

ashishpapanai commented 4 years ago

Are contributions from outside the organization also accepted? I would like to work on this issue.

huningxin commented 4 years ago

Are contributions from outside the organization also accepted?

Yes. The contributions would be highly appreciated.

I would like to work on this issue.

Thanks in advance. Feel free to send out the pull request and link to this issue.

ibelem commented 4 years ago

@ashishpapanai We welcome contributions from outside all the time, thank you!