<!DOCTYPE html>
<html>
<head>
<title>Parcel Sandbox</title>
<meta charset="UTF-8" />
<!-- Load TensorFlow.js -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@1.2"></script>
<!-- Load BodyPix -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/body-pix@2.0"></script>
</head> <body>
<img
id="image"
src="data:image/image.jpg"
/>
<canvas id="canvas"/> <script>
const img = document.getElementById("image"); function loadAndPredict() {
bodyPix.load()
.then((net)=> net.segmentPersonParts(img))
.then(partSegmentation => {
const coloredPartImage = bodyPix.toColoredPartMask(partSegmentation);
const opacity = 0.7;
const flipHorizontal = false;
const maskBlurAmount = 0;
const pixelCellWidth = 10.0;
const canvas = document.getElementById('canvas');
// Draw the pixelated colored part image on top of the original image onto a
// canvas. Each pixel cell's width will be set to 10 px. The pixelated colored
// part image will be drawn semi-transparent, with an opacity of 0.7, allowing
// for the original image to be visible under.
bodyPix.drawPixelatedMask(
canvas, img, coloredPartImage, opacity, maskBlurAmount,
flipHorizontal, pixelCellWidth);
});
}
loadAndPredict();
</script>
</body>
</html>

最新文章

  1. hive 调优总结
  2. 基于VC的ACM音频编程接口压缩Wave音频(一)
  3. C++: DataGridView::DataSource
  4. Android-Universal-Image-Loader开源项目的简要说明及使用实例
  5. JQuery,UIbootstrap风格弹出层
  6. [POJ1236]Network of Schools(并查集+floyd,伪强连通分量)
  7. [学习笔记] Web设计过程中该做和不该做的
  8. PYTHON--定期监测服务器端口,并将结果写入MYSQL
  9. 使用回调接口实现ActiveX控件和它的容器程序的通讯
  10. cocos2dx 3.0 飞机大战
  11. leetcode第40题--First Missing Positive
  12. tomcat 设置jvm 参数
  13. 软工作业PSP与单元测试训练:java语言判断电子邮箱格式
  14. CountDownLatch 闭锁、FutureTask、Semaphore信号量、Barrier栅栏
  15. mongoDB基础使用
  16. SpringBoot------连接mysql时出现警告:Establishing SSL connection without server&#39;s identity verification is not recommended
  17. 简单mysql常用命令
  18. 正确配置 debian squeeze apt 源
  19. Docker入门与实践之 Dockerfile 语法详解
  20. 雷林鹏分享:Ruby 数组(Array)

热门文章

  1. JPA中JpaRepository的使用
  2. python+selenium实现自动化百度搜索关键词
  3. Python之路【第二十八篇】:django视图层、模块层
  4. Visual Studio 2019激活
  5. 解决clover配置文件conf.plist中nv_disable=1或者nvda_drv=1不生效或者说不能删除的问题
  6. MNIST机器学习入门(一)
  7. C# vb .net实现博物馆哑色框架特效滤镜
  8. FORM表单 onclick()与onsubmit()
  9. ioremap
  10. 在Controller中添加事务管理