| 1461 | } |
| 1462 | |
| 1463 | void mtmd_debug_preprocess_image(mtmd_context * ctx, const std::vector<uint8_t> & rgb_values, int nx, int ny) { |
| 1464 | if (!ctx->ctx_v) { |
| 1465 | LOG_ERR("%s: model does not support vision input\n", __func__); |
| 1466 | return; |
| 1467 | } |
| 1468 | clip_image_u8 img_u8; |
| 1469 | img_u8.nx = nx; |
| 1470 | img_u8.ny = ny; |
| 1471 | img_u8.buf = rgb_values; |
| 1472 | clip_image_f32_batch batch_f32; |
| 1473 | GGML_ASSERT(ctx->image_preproc != nullptr); |
| 1474 | bool ok = ctx->image_preproc->preprocess(img_u8, batch_f32); |
| 1475 | if (!ok) { |
| 1476 | LOG_ERR("%s: failed to preprocess image\n", __func__); |
| 1477 | return; |
| 1478 | } |
| 1479 | LOG_INF("%s: preprocessed image to batch_f32 with %d entries\n", __func__, (int)batch_f32.entries.size()); |
| 1480 | for (size_t i = 0; i < batch_f32.entries.size(); i++) { |
| 1481 | LOG_INF("%s: entry %zu has nx=%d, ny=%d\n", __func__, i, batch_f32.entries[i]->nx, batch_f32.entries[i]->ny); |
| 1482 | // TODO: better way to dump entry content? |
| 1483 | } |
| 1484 | } |
| 1485 | |
| 1486 | void mtmd_debug_preprocess_audio(mtmd_context * ctx, const std::vector<float> & samples) { |
| 1487 | if (!ctx->ctx_a) { |
no test coverage detected