Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Cannot convert YOLO .pt models using convert script or Optimum #1392

@ayan4m1

Description

@ayan4m1

System Info

tf.js version: git latest
Node version: 22/24 (tried both)

Environment/Platform

  • Website/web-app
  • Browser extension
  • Server-side (e.g., Node.js, Deno, Bun)
  • Desktop app (e.g., Electron)
  • Other (e.g., VSCode extension)

Description

I have been pulling my hair out trying to get either an object-detection or image-classification task working with the YOLO model series. I have trained a YOLO11 model on a watermarking dataset for 10 epochs and have the resulting .pt file. I converted it using Optimum but I get the following error when running the inference code in the Repro section.

Error

node:events:502
      throw er; // Unhandled 'error' event
      ^

Error: An error occurred during model execution: "Missing the following inputs: images.
    at validateInputs (file:///C:/code/diy-discord-bot/node_modules/@huggingface/transformers/dist/transformers.node.mjs:7681:15) 
    at sessionRun (file:///C:/code/diy-discord-bot/node_modules/@huggingface/transformers/dist/transformers.node.mjs:7713:27)     
    at Function.encoderForward [as _forward] (file:///C:/code/diy-discord-bot/node_modules/@huggingface/transformers/dist/transfor
mers.node.mjs:7874:18)
    at Function.forward (file:///C:/code/diy-discord-bot/node_modules/@huggingface/transformers/dist/transformers.node.mjs:8583:27
)
    at Function._call (file:///C:/code/diy-discord-bot/node_modules/@huggingface/transformers/dist/transformers.node.mjs:8572:27) 
    at Function._call (file:///C:/code/diy-discord-bot/node_modules/@huggingface/transformers/dist/transformers.node.mjs:13157:59)
    at Function.closure [as model] (file:///C:/code/diy-discord-bot/node_modules/@huggingface/transformers/dist/transformers.node.
mjs:31366:28)
    at Function._call (file:///C:/code/diy-discord-bot/node_modules/@huggingface/transformers/dist/transformers.node.mjs:23932:35)
    at async Client.messageCreate (file:///C:/code/diy-discord-bot/lib/handlers/nsfw.js:25:28)
Emitted 'error' event on Client instance at:
    at emitUnhandledRejectionOrErr (node:events:407:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:92:21)

Node.js v22.12.0

Reproduction

  1. Run the following code in an ESM script
const watermarkPipe = await pipeline(
  'object-detection',
  'ayan4m1/Watermark-Detection-YOLO11-ONNX'
);

const image = await RawImage.read('https://img.freepik.com/free-vector/cartoon-school-bus-white-background_1308-132853.jpg');
const result = await watermarkPipe([image]);

console.dir(result);
  1. Observe error

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions