• Comprehensive model validation.

    Performs both size validation and integrity verification on a model. This is the recommended way to validate models before use.

    Parameters

    • modelName: string

      Name of the model file

    • modelData: ArrayBuffer

      Model data as ArrayBuffer

    Returns Promise<boolean>

    Promise - True if all validations pass

    Example

    // Download and validate a model
    const response = await fetch('/models/u2net.onnx');
    const modelData = await response.arrayBuffer();

    const isValid = await validateModel('u2net.onnx', modelData);
    if (isValid) {
    console.log('Model validation passed - safe to use');
    // Proceed with model loading
    } else {
    console.error('Model validation failed - do not use');
    }