Comments (5)
Hi @JohnZcp - I'd first ensure the model file exists and is non-zero, and second that the relative require()
path is correct. These are the two things that usually trip me up here.
Given that you're loading require('../models/mobilenet_v3_small.ptl');
from within /Users/ziyuanzhou/Desktop/signdectection/signdetection/src/screens/CameraScreenTest.js
I would expect it to resolve to /Users/ziyuanzhou/Desktop/signdectection/signdetection/src/models/mobilenet_v3_small.ptl
and so:
ls -lh /Users/ziyuanzhou/Desktop/signdectection/signdetection/src/models/mobilenet_v3_small.ptl
My guess is that you need another ../
in the relative require()
path, since in the default project template, models/
is at the same level as src/
.
from playtorch.
models/ and screens/ are at the same level, they are in the src/. I tried to enter the path layer by layer, and it seems like my project just doesn't recognize this .ptl type file.
from playtorch.
I don't know what backs the autocomplete in your editor, but the asset loading is handled by Metro, and that is driven by the metro.config.js
at the project root. To support the model files, the .ptl
extension is added to resolver.assetExts
.
From your error message, it almost seems like Metro is trying a regex (for the given extensions) and that .ptl
is not present. I don't know why that would be.
Did the default project template work for you? At what point did model loading break?
Hmm, looking at the Metro documentation, I see there is assetExts
as well as sourceExts
: https://facebook.github.io/metro/docs/configuration/#resolver-options
I wonder if sourceExts
is used for files below the src/
directory, and assetExts
elsewhere. Can you try moving models/
up a level to be a peer to src/
?
from playtorch.
Thanks for your help. I just figure out the problem. All I need is to do is adding the .ptl extension in sourceExts in metro.config.js, and be sure the model file is placed under src/ .
from playtorch.
I'm glad to hear that you found a solution, @JohnZcp!
One more thing you might want to check is to ensure that this works in the release build. Metro handles file loading differently in dev mode and release mode, and it may have an impact on your approach here.
For example, if you normally build in dev mode with yarn android
, try out release mode with yarn android --variant=release
.
from playtorch.
Related Issues (20)
- PlayTorchJSIModule not found - ios & android m2 macbook pro HOT 2
- It is not possible to convert audio float32 tensor to playable uint8 audio expected by .audioFromBytes() HOT 1
- How to specify interpolation in transforms.resize?
- AudioUtil is not working on Android
- How to convert my yolov5s.pt to yolov5s.ptl HOT 1
- resize function gives error: 'Factory function resize expects 1 argument but 4 are given.'
- Cannot scan QR code from the PlayTorch app HOT 2
- playtorchjsimodule not found
- Mac M1 tutorial failure HOT 2
- unable to load local .ptl model HOT 2
- How to export a Huggingface transfromer model? HOT 3
- react_native_pytorch_core error during gradle build HOT 15
- image data fetch
- Is there a processing step im missing when using a custom trained yolo model?
- Is this project still maintained?
- Unable to work
- CMake Error
- Android build fails | Expo app using prebuild HOT 4
- 'react_native_pytorch_core-Swift.h' file not found during ios build HOT 1
- Add how to use EAS (Expo Application Service) build within this tutorial
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from playtorch.