uniapp开发app框架在提升开发效率中的独特优势与应用探索
719
2022-10-27
WebDNN: Web浏览器上最快的DNN执行框架
WebDNN: Fastest DNN Execution Framework on Web Browser
WebDNN is an open source software framework for executing deep neural network (DNN) pre-trained model on web browser.
Japanese(日本語) READMEwebsitedocument
Why is WebDNN needed?
Deep neural network (DNN) is getting much attention to use in many applications. However, it requires a lot of computational resources, and there are many tremendous processes to setup execution environment based hardware acceleration such as GPGPU. Therefore providing DNN applications to end-users is very hard.
WebDNN solves this problem by using web browser as installation-free DNN execution framework. This framework optimizes trained DNN model to compress the model data and accelerate the execution, and executes it with novel JavaScript API such as WebAssembly and WebGPU to achieve zero-overhead execution. Empirical evaluations showed that it achieved more than 200x acceleration.
Performance
Compared processing time with Keras.jsTest environment: Mac Book Pro early 2015macOS 10.12.4 SierraIntel Core i5 2.7 GHz CPU16 GB MemoryIntel Iris Graphics 6100 GPUSafari Technology Preview 30 Model: VGG16[1], Inception-v3[4], and ResNet50[2].Input Shape: (1, 299, 299, 3) for Inception-v3, (1, 224, 224, 3) for others.
Elapsed time per image are shown in vertical axis as logarithmic scale.
WebDNN with WebGPU backend was significantly faster than Keras.js. WebDNN with WebAssembly backend was comparable with GPU backend of Keras.js. In each DNN model and backend, WebDNN obtained better results in terms of speed. More speed improvement is observed when the optimizations are applied in the graph transpiler.
Getting started in 30 seconds
Let's convert and execute ResNet50 pre-trained Keras model[3] on your web browser.
First, save ResNet50 pre-trained model provided by Keras.
from keras.applications import resnet50model = resnet50.ResNet50(include_top=True, weights='imagenet')model.save("resnet50.h5")
Next, convert the model by CLI. In this phase, model is optimized.
python ./bin/convert_keras.py resnet50.h5 --input_shape '(1,224,224,3)' --out output
Then, generated files (called as Descriptor) can be loaded and executed by JavaScript as follows,
let runner;async function init() { // Initialize descriptor runner runner = await WebDNN.load('./output');}async function run() { // Set the value into input variable. runner.getInputViews()[0].set(loadImageData()); // Run await runner.run(); // Show the result console.log('Output', WebDNN.Math.argmax(runner.getOutputViews()[0].toActual()));}
WebDNN also supports Caffemodel and Chainer model.
For more information, please see documents.
Setup
Please see documents.
[1] Karen Simonyan and Andrew Zisserman. 2014. Very Deep Convolutional Networks for Large-Scale Image Recognition. In Proceedings of the International Conference on Learning Representations (ICLR).[2] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. 2015. Deep Residual Learning for Image Recognition. In Proceedings of the Conference on Computer Vision and Pattern Recognition (CVPR). https://github.com/KaimingHe/deep-residual-networks[3] Applications - Keras Documentation[4] Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. 2016. Rethinking the Inception Architecture for Computer Vision. In Proceedings of the Conference on Computer Vision and Pattern Recognition (CVPR).
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~