Embryo-One's picture
Upload 49 files
ed9f15f verified
raw
history blame contribute delete
855 Bytes
/**
* YOLO Detection - Detect and crop embryos
*/
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';
/**
* Detect embryos using YOLO
*/
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);
}
/**
* Check if YOLO model is available
*/
export function isYOLOAvailable() {
return !!getModel('yolo');
}