pytorch / android-demo-app

PyTorch android examples of usage in applications
1.47k stars 606 forks source link

AttributeError: Can't get attribute 'C3' on <module 'models.common' from './models/common.py' #168

Open TehKonnos opened 3 years ago

TehKonnos commented 3 years ago

Hello! I run models/export.py from https://github.com/jeffxtang/yolov5 with the supposed changes and I get the error above. I have trained a binary custom yolov5 model with yolov5s.yaml. Any suggestions?

jeffxtang commented 3 years ago

Which torch and torchvision versions are you using?

TehKonnos commented 3 years ago

Torch = 1.9.0+cu102 Torchvision = 0.10.0+cu102

I noticed that it exports yolov5s.pt but not my best.pt

TehKonnos commented 3 years ago

Also my model is trained with --img 640 as yolov5s, but in android (if I export with ultrlytics export method) I get this:


2021-07-12 21:50:12.954 31189-31230/org.pytorch.demo.objectdetection E/Perf: Fail to get file list org.pytorch.demo.objectdetection
2021-07-12 21:50:12.954 31189-31230/org.pytorch.demo.objectdetection E/Perf: getFolderSize() : Exception_1 = java.lang.NullPointerException: Attempt to get length of null array
2021-07-12 21:50:12.954 31189-31230/org.pytorch.demo.objectdetection E/Perf: Fail to get file list org.pytorch.demo.objectdetection
2021-07-12 21:50:12.954 31189-31230/org.pytorch.demo.objectdetection E/Perf: getFolderSize() : Exception_1 = java.lang.NullPointerException: Attempt to get length of null array
2021-07-12 21:50:13.058 31189-31189/org.pytorch.demo.objectdetection E/objectdetectio: Invalid ID 0x00000000.```
TehKonnos commented 3 years ago

I found my solution. Tell me if it's correct. I used ultralytics/yolov5 and added the export.py in the yolov5/models directory. Still in android studio I receive the same error :/

tsukasagenesis commented 3 years ago

same error there :/