-
Notifications
You must be signed in to change notification settings - Fork 136
Crash on Redmi Note 3 Pro - read memory from 0xef2d7f5c failed #14
Comments
I meet similar problem:
Do you have any idea about it? |
this is probably an issue with this TODO: I will look into it |
I was getting a similar (probably the same) error. The problem seems to be that when you iterate through the image rows in Java_facebook_f8demo_ClassifyCamera_classificationFromCaffe2, you divide the memory location for the U and V channels by 2, when you should be dividing by 4 (as both height and width have been halved), i.e. In my case I was still getting junk classification results, which turned out to be due to my image being padded (I think this might be device dependent) so I replaced w in the above line with the row stride (in my case 512). |
@m00nkeh is probably right. Looking at this I think I did the math wrong. |
I think the transformation from YUV420 to RGB has some problems with @m00nkeh's revision. The structure for YUV420 in Android is not the same as the one in this.There are several formats for YUV420. And when I print the length for Y U V channel, I got 'Y_len:76800 U_len:38399 V_len:38399'. And I think the reason for this result is that the YUV420 format in Android is NV12 rather than YV12. The U and V channels share the same plane, so the memory location for U and V channels should be divided by 2 rather than 4. So I think @bwasti is right. I have also done some experiments: print the input_data in JNI to a file
pull the file with ADB and restore the picture with this on PC. If dividing the memory location for U and V by 4, the location of color in restored pictures will shift greatly. However, if the location is divided by 2, the restored picture is correct. I have tested on OnePlus 5 and Pixel. And after this revision, the accuracy of the output became better and can compete with the results on PC. |
App crashes few seconds after starting attempting to get
char y = Y_row[w_offset + j];
I debugging what happens and I find Y_row give me
size of Y_len is 40 944 but in this line trying to get Y_row from Y_data[(h_offset + i) * w] which is equal to Y_data[44880]. Also applying stack trace generated with ndk-stack
The text was updated successfully, but these errors were encountered: