machine-learning - 有没有办法在 ml5 yolo() 中使用自定义模型?
问题描述
因为ml5yolo()
提到
“这个实现很大程度上来自 ModelDepot”。
它没有提到它正在使用哪个预训练模型,或者你如何使用你自己的训练模型
let video;
let yolo;
let status;
let objects = [];
function setup() {
createCanvas(320, 240);
video = createCapture(VIDEO);
video.size(320, 240);
// Create a YOLO method
yolo = ml5.YOLO(video, startDetecting);
// Hide the original video
video.hide();
status = select('#status');
}
function draw() {
image(video, 0, 0, width, height);
for (let i = 0; i < objects.length; i++) {
noStroke();
fill(0, 255, 0);
text(objects[i].className, objects[i].x * width, objects[i].y * height - 5);
noFill();
strokeWeight(4);
stroke(0, 255, 0);
rect(objects[i].x * width, objects[i].y * height, objects[i].w * width, objects[i].h * height);
}
}
function startDetecting() {
status.html('Model loaded!');
detect();
}
function detect() {
yolo.detect(function(err, results) {
objects = results;
detect();
});
}
解决方案
我一直在阅读 yolo 文档,我找到了一种方法:
ml5-yolo-library -> 大量源自https://github.com/ModelDepot/tfjs-yolo-tiny (ModelDepot: modeldepot.io)
在这里-> https://modeldepot.io/mikeshi/tiny-yolo-in-javascript
说 -> 这个模型是从原始的 Darknet Tiny YOLO cfg 和权重创建的,通过 YAD2K 将其转换为 Keras,然后使用 tensorflowjs_converter 将其转换为 Tensorflow.js 格式。
所以,我现在正在尝试做和你一样的事情。希望我能找到方法
推荐阅读
- android - 组合请求时使用 Retrofit2 和 RxJava2 调用 web 服务后执行方法的问题
- javascript - 在事件处理函数中返回一个值
- autodesk-forge - 在工作项的作业状态中,“状态”显示“成功”,即使处理因异常而失败
- reactjs - 尝试将 React 组件与 Redux 连接时获取“this.props.user”未定义
- php - WooCommerce 在 woocommerce_cart_calculate_fees 过滤器中获取产品 ID
- javascript - 使用 execCommand 复制的图像不会粘贴到任何地方
- android-mediacodec - Android MediaCodec onOutputBufferAvailable - 如何控制回调频率?
- python - Pandas 合并相同的值行并拆分不同的值列
- reactjs - axios 请求在 .forEach() 和 .map() 内都不起作用
- c# - Visual Studio 如何创建和运行 docker 容器?