pytorch / android-demo-app

PyTorch android examples of usage in applications
1.46k stars 604 forks source link

D2go cannot run detect #214

Closed cloveropen closed 2 years ago

cloveropen commented 2 years ago

I follow the https://github.com/facebookresearch/d2go/blob/main/demo/d2go_beginner.ipynb train a ballon custom model,and exported as model.jit,now I use it in https://github.com/jeffxtang/android-demo-app/tree/pt1.10 D2go sample,change below: classes.txt : balloon MainActivity.java: mModule = PyTorchAndroid.loadModuleFromAsset(getAssets(), "model.jit"); It can run ,when I click "detect",get the following error:

22698-23150/org.pytorch.demo.objectdetection E/AndroidRuntime: FATAL EXCEPTION: Thread-2 Process: org.pytorch.demo.objectdetection, PID: 22698 com.facebook.jni.CppException: forward() Expected a value of type 'Tensor' for argument 'argument_1' but instead found type 'List[Tensor]'. Position: 1 Declaration: forward(torch.detectron2.export.flatten.TracingAdapter self, Tensor argument_1) -> ((Tensor, Tensor, Tensor, Tensor)) Exception raised from checkArg at ../aten/src/ATen/core/function_schema_inl.h:162 (most recent call first): (no backtrace available) at org.pytorch.NativePeer.forward(Native Method) at org.pytorch.Module.forward(Module.java:52) at org.pytorch.demo.objectdetection.MainActivity.run(MainActivity.java:241) at java.lang.Thread.run(Thread.java:923)

can anynone give me some help?

dipu0 commented 1 year ago

I am facing many issues while training my custom dataset. can you share your notebook with me?