question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Backward compatibility of ptl with live.spec on iOS

See original GitHub issue

Version

0.2.0

Problem Area

react-native-pytorch-core (core package)

Steps to Reproduce

  1. make ptl file with live.spec.json
  2. build a project with ptl on iOS
  3. inference a input image
  4. get this error
code: EUNSPECIFIED, 
domain: react_native_pytorch_core.BaseIValuePackerError, 
message: decodeObjectsError, 
name: Error, 
nativeStackIOS: [Array], 
stack: 
Error: decodeObjectsError

the project works well in 0.1.3, but the error comes up after upgrade to 0.2.0. Is there no backward compatibility for ptl with live.spec?

No problem on Android.

Expected Results

No error

Code example, screenshot, or link to repository

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
SomaKishimotocommented, Aug 5, 2022

@raedle , thanks for resolving the issue! I’ve verified that your fix works fine.

I will try to upgrade to the new PlayTorch SDK JavaScript API by referring to your explanation and let you know if I get stuck.

Thank you always!

1reaction
raedlecommented, Aug 5, 2022

@SomaKishimoto, we found the culprit. After upgrading the LibTorch-Lite library from version 1.10.0 to 1.12.0, the kind support changed to c10::DynamicType. Unfortunately, the unit tests didn’t catch this. We have a fix in #99. When we merged the change, it will be available in the react-native-pytorch-core@nightly or the next planned release 0.2.1.

Alternatively, as mentioned, it might be worth upgrading to the new PlayTorch SDK JavaScript API. The useObjectDetection.ts in the repo should be compatible with your model’s interface (according to the live spec).

You’d have to change the mean and std for the normalize function in the packFn (see code).

// Normalize the tensor image with mean and standard deviation
const normalize = T.normalize([0.0, 0.0, 0.0], [0.0039216, 0.0039216, 0.0039216]);
tensor = normalize(tensor);

The scaleWidth and scaleHeight can be set in the resize function in the packFn (see code)

// Resize the image tensor to 3 x min(height, width)
const resize = T.resize([scaleHeight, scaleWidth]);
tensor = resize(tensor);

In the unpackFn, use the probabilityThreshold and resolve the classes (see code)

Let me know if you have question or need advice!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Swift UI backward compatibility | Apple Developer Forums
I am new to SwiftUI and thinking of converting my UIKit app. My deployment target is the last version of iOS 13. If...
Read more >
Backward Compatibility - Ableton
Any set made in an earlier version of Live can be opened in any later versions of Live. For example, a set made...
Read more >
Xbox Backward Compatible Games
Discover the library of Xbox backward compatible games. Experience game franchises from past generations and enjoy the games you love at no additional...
Read more >
Swift's new concurrency system gains backward compatibility ...
Starting in Xcode 13.2, Swift's new suite of concurrency features are now backward compatible all the way back to iOS 13, macOS Catalina, ......
Read more >
iOS 16 Supported Devices: Which iPhones are compatible?
The older ones lacked the artificial intelligence power to handle things like Live Text in Photos and on-device speech processing for Siri.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found