Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Is initial maxIndex = -1 in BoundingBoxesUnpacker.swift right? then, I'd like to know the reason. #48

Closed
SomaKishimoto opened this issue Feb 26, 2022 · 2 comments
Assignees

Comments

@SomaKishimoto
Copy link

SomaKishimoto commented Feb 26, 2022

Version

0.1.3, and also latest commits

Problem Area

react-native-pytorch-core (core package)

Steps to Reproduce

  1. create object detection model .ptl file
  2. put the model file at src/app/models/ and input the ModelInfo in models/index.tsx
  3. build and run the project
  4. Fatal error: Index out of range happens

I'm enjoying to do real-time object detection on ios device because of great PyTorch live that you've been making.
I'm a beginner at Swift, so I don't know what maxIndex value= -1 indicates.
After changed maxIndex value -1 ⇨ 0, this error never happen.
So, I thought the value = 0 is right one.

Could you tell me whether the maxIndex value = -1 is correct and then the reason Maxindex = -1 is set, thanks in advance.

Expected Results

"Fatal error: Index out of range" doesn't happen

Code example, screenshot, or link to repository

screenshot_maxindex_cause_indexerror

@liuyinglao
Copy link
Contributor

@SomaKishimoto good catch! This is definitely a bug. I will fix it and thanks for reporting!

@liuyinglao liuyinglao self-assigned this Mar 11, 2022
facebook-github-bot pushed a commit that referenced this issue Mar 11, 2022
Summary:
#48 #48

The unpacker is trying to return the index of the maximum element, but iterating from -1. It will throw an error if the 0-index element happened to be the largest.

Reviewed By: chrisklaiber

Differential Revision: D34833676

fbshipit-source-id: fefd2f1c6144de9fcf0bb7b167e8a09280de6f28
@liuyinglao
Copy link
Contributor

@SomaKishimoto Fix is pushed and I will close the issue for now. Feel free to reopen or create new one if you are seeing other issue!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants