首页 > 解决方案 > 有没有办法在 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();
  });
}

标签: machine-learningcomputer-visionobject-detectiontensorflow.jsyolo

解决方案


我一直在阅读 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 格式。

所以,我现在正在尝试做和你一样的事情。希望我能找到方法


推荐阅读