|
|
|
|
|
|
|
|
|
|
|
|
|
|
import { getModel } from '../state.js';
|
|
|
import { DETECTION_CONFIG } from '../config.js';
|
|
|
import { preprocessImageYOLO } from '../processing/imagePreprocessing.js';
|
|
|
import { postprocessYOLO } from '../processing/yoloPostprocessing.js';
|
|
|
import { loadImage } from '../utils/imageUtils.js';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export async function detectEmbryos(imageData) {
|
|
|
const img = await loadImage(imageData);
|
|
|
const inputTensor = await preprocessImageYOLO(img, DETECTION_CONFIG.yolo.inputSize);
|
|
|
|
|
|
const feeds = { images: inputTensor };
|
|
|
const results = await getModel('yolo').run(feeds);
|
|
|
|
|
|
return postprocessYOLO(results, img);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function isYOLOAvailable() {
|
|
|
return !!getModel('yolo');
|
|
|
}
|
|
|
|