jetpacapp / DeepBeliefSDK

The SDK for Jetpac's iOS Deep Belief image recognition framework
Other
2.86k stars 437 forks source link

WebGl misprediction in demo #57

Closed dronus closed 8 years ago

dronus commented 9 years ago

On the demo page http://jetpacapp.github.io/DeepBeliefSDK/ , having WebGL enabled runs, but always predicts slightly changing activations of around 52% for 'European Hoopoe' and 48% 'Hacksaw'. No other activation is ever predicted. Disabling WebGL solves the problem.

Chrome Browser 37.0.2062.120 on Linux using an Intel HD3000 GPU.

dronus commented 9 years ago

There are no WebGL related warnings or errors on the JS console, and other WebGL sites are working well without glitches.

waylonflinn commented 8 years ago

Having the same issue but seeing the following error in the console

WebGL: INVALID_OPERATION: readPixels: invalid format/type combination

This looks like the relevant function in the Chrome source:

bool WebGLRenderingContextBase::validateReadPixelsFormatTypeCombination(GLenum format, GLenum type, GLenum readBufferInternalFormat, GLenum readBufferType)
{
    GLenum acceptedFormat = 0, acceptedType = 0;
    switch (readBufferInternalFormat) { // This is internalformat.
    case GL_R8UI:
    case GL_R16UI:
    case GL_R32UI:
    case GL_RG8UI:
    case GL_RG16UI:
    case GL_RG32UI:
    // All the RGB_INTEGER formats are not renderable.
    case GL_RGBA8UI:
    case GL_RGB10_A2UI:
    case GL_RGBA16UI:
    case GL_RGBA32UI:
        acceptedFormat = GL_RGBA_INTEGER;
        acceptedType = GL_UNSIGNED_INT;
        break;
    case GL_R8I:
    case GL_R16I:
    case GL_R32I:
    case GL_RG8I:
    case GL_RG16I:
    case GL_RG32I:
    case GL_RGBA8I:
    case GL_RGBA16I:
    case GL_RGBA32I:
        acceptedFormat = GL_RGBA_INTEGER;
        acceptedType = GL_INT;
        break;
    default:
        acceptedFormat = GL_RGBA;
        switch (readBufferType) {
        case GL_HALF_FLOAT:
        case GL_HALF_FLOAT_OES:
        case GL_FLOAT:
        case GL_UNSIGNED_INT_10F_11F_11F_REV:
            acceptedType = GL_FLOAT;
            break;
        default:
            acceptedType = GL_UNSIGNED_BYTE;
            break;
        }
        break;
    }
    if (!(format == acceptedFormat && type == acceptedType)
        && !(readBufferInternalFormat == GL_RGB10_A2 && format == GL_RGBA && type == GL_UNSIGNED_INT_2_10_10_10_REV)) {
        // Check against the implementation color read format and type.
        WGC3Dint implFormat = 0, implType = 0;
        webContext()->getIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT, &implFormat);
        webContext()->getIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE, &implType);
        if (!implFormat || !implType || format != static_cast<GLenum>(implFormat) || type != static_cast<GLenum>(implType)) {
            synthesizeGLError(GL_INVALID_OPERATION, "readPixels", "invalid format/type combination");
            return false;
        }
    }
    return true;
}

taken from here: https://chromium.googlesource.com/chromium/blink/+/master/Source/modules/webgl/WebGLRenderingContextBase.cpp#3666