Comments (6)
I found it in the code as plain and simple "tensor_to_image", I guess it should be added to the spec API docs.
from playtorch.
@Sxela yes, you have found the correct unpacker! However, note that it is currently undocumented and the behavior may change in a future release. Exposing this image unpacker is on our roadmap.
One gotcha to be aware of: the current reverse normalization dynamically determines the range of values in the data. If your range is <1 it will cause a divide by zero, which results in a float value of -Infinity
or Infinity
on Android for all pixels, resulting in an all-white or all-black image. A hacky workaround to control the range is to ensure that your model sets one pixel to the minimum desired value and one to the maximum value. A reasonable solution might be for the unpacker to allow specification of the range in JSON, and falling back to the current dynamic range detection. If that is something you would be interested in tackling, let us know, your PR would be welcome!
from playtorch.
I suppose you can just use normalization stats from the packer settings, and fall back to autodetection if none were provided.
from playtorch.
I also would like to use image2image models but I'm not sure how I can "tensor_to_image" unpacker because the following command seems to install the stable version of pytorch-live, which does not include "tensor_to_image" unpacker:
npx react-native init MyProject --template react-native-template-pytorch-live
How can I specify to use the pytorch-live version with the unpacker? I'm using it on Windows for Android.
from playtorch.
@Sxela and @mitsunami, the react-native-pytorch-core
release candidate v0.2.0-rc.2
has a PyTorch-inspired API to support a more flexible data processing. For example, have a look at the useAnimeGANv2.ts for an example how image to image works with this API.
More details on available ops are is in the API docs:
- https://pytorch.org/live/docs/next/api/core/interfaces/torchlive_torch.torch/
- https://pytorch.org/live/docs/next/api/core/interfaces/torchlive_torch.tensor/
Feel free to reach out on Discord or here if any ops are missing for your use cases!
from playtorch.
Closing this issue out since the packer / unpacker approach was removed with 0.2.2. Check out the PyTorch-inspired API in the README as an alternative that avoids these issues: https://github.com/facebookresearch/playtorch/tree/main/react-native-pytorch-core#example-usage
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.