pytorch / android-demo-app

PyTorch android examples of usage in applications
1.48k stars 607 forks source link

sendAppFreezeEvent Error when Forwarding Inpug on Custom Model #22

Open KengoMachida opened 5 years ago

KengoMachida commented 5 years ago

Hi,

I transformed my custom model by doing same procedure of pytorch tutorial and it seems no problem when loading the model in Android.

Then I feed the input (exactly the same image that is included the assets folder of HelloWorldApp) to the loaded model by using model.forward(IValue.from(inputTensor)).ToTensor() like MainActivity.java of HelloWorldApp.

Only one line I have changed from original MainActivity.java of HelloWorldApp is the line which tries to load the model in assets folder because of loading custom model.

And error occurred, the details are below: 2019-10-25 13:20:53.412 3461-3532/org.pytorch.helloworld E/ZrHungImpl: sendAppFreezeEvent failed!

I checked there was no problem just before feeding the input to the model by using log.d funciton. I also searched sendAppFreezeEvent but there were no enough information.

Are there any suggestions? Thanks,

IvanKobzarev commented 4 years ago

Hello @Kengo-Machida, Sorry for my late reply.

I could only guess that appFreezeEvent may be connected with deadlock issue in mobile build: There was deadlock issue in mobile build, that might be the reason of this hanging. It was fixed last week: issue: pytorch/pytorch#29821 commit: pytorch/pytorch@b730d04

Please check the latest nightly builds if it is still a problem or not. To try nightly builds:

repositories {
    maven {
        url "https://oss.sonatype.org/content/repositories/snapshots"
    }
}

dependencies {
    ...
    implementation 'org.pytorch:pytorch_android:1.4.0-SNAPSHOT'
    implementation 'org.pytorch:pytorch_android_torchvision:1.4.0-SNAPSHOT'
    ...
}

If you still have this issue, could you please add full logcat output, which android device do you use, what is the model do you run.