-
报道
2022-06-15 10:01 -
报道
2022-06-11 19:33一起摸鱼
-
报道
2022-06-11 19:33小改改是指什么==
-
onnxruntime-inference-examples 安卓使用
2022-06-10 17:37fun preProcess(bitmap: Bitmap): FloatBuffer { val imgData = FloatBuffer.allocate( DIM_BATCH_SIZE * DIM_PIXEL_SIZE * IMAGE_SIZE_X * IMAGE_SIZE_Y ) imgData.rewind() val stride = IMAGE_SIZE_X * IMAGE_SIZE_Y val bmpData = IntArray(stride) bitmap.getPixels(bmpData, 0, bitmap.width, 0, 0, bitmap.width, bitmap.height) for (i in 0..IMAGE_SIZE_X - 1) { for (j in 0..IMAGE_SIZE_Y - 1) { val idx = IMAGE_SIZE_Y * i + j val pixelValue = bmpData[idx] // imgData.put(idx, (((pixelValue shr 16 and 0xFF) / 255f - 0.485f) / 0.229f)) // imgData.put(idx + stride, (((pixelValue shr 8 and 0xFF) / 255f - 0.456f) / 0.224f)) // imgData.put(idx + stride * 2, (((pixelValue and 0xFF) / 255f - 0.406f) / 0.225f)) imgData.put(idx, pixelValue*1.0f) // imgData.put(idx + stride, pixelValue*1.0f) // imgData.put(idx + stride * 2, pixelValue*1.0f) } } imgData.rewind() return imgData }
这么写我总感觉不太对,而且模型input size 是48 48会不会太小了,不改动 imgData.put会报错,应该是这个计算的地方错了。
1
2
大佬我的身份怎么还是新手,是你给换身份吗