GithubHelp home page GithubHelp logo

Comments (5)

glenn-jocher avatar glenn-jocher commented on May 22, 2024 4

@CF2220160244 I get the same error on printing numpy arrays, but I think in my case this is a PyCharm problem. In PyCharm if I convert the numpy array to a torch tensor print works fine:

labels0 = np.loadtxt(label_path, dtype=np.float32).reshape(-1, 5)

print(labels0)
Traceback (most recent call last):
...
IndexError: tuple index out of range

print(torch.from_numpy(labels0))
tensor([[76.00000,  0.35609,  0.44456,  0.54970,  0.16180],
        [ 0.00000,  0.48129,  0.40587,  0.94952,  0.80312]])

In Spyder the same operation shows no errors:

ipdb> labels0 = np.loadtxt(label_path, dtype=np.float32).reshape(-1, 5)

ipdb> labels0
array([[76.      ,  0.356086,  0.444563,  0.549703,  0.161803],
       [ 0.      ,  0.481289,  0.405874,  0.949516,  0.803123]], dtype=float32)

ipdb> print(labels0)
[[76.        0.356086  0.444563  0.549703  0.161803]
 [ 0.        0.481289  0.405874  0.949516  0.803123]]

from yolov3.

simedw avatar simedw commented on May 22, 2024

The issue seem to be that the print option for float_kind has a typo (https://github.com/ultralytics/yolov3/blob/master/utils/utils.py#L10).
Try changing
np.set_printoptions(linewidth=320, formatter={'float_kind': '{11.5g}'.format})
to
np.set_printoptions(linewidth=320, formatter={'float_kind': '{:11.5g}'.format})
(format was trying to access the 11th element of the input instead of using 11.5g as formatting)

from yolov3.

glenn-jocher avatar glenn-jocher commented on May 22, 2024

@simedw you are right, this fixes the problem! I implemented this change in commit bce94f6.

from yolov3.

NaumanKhan665 avatar NaumanKhan665 commented on May 22, 2024

@simedw you are right, this fixes the problem! I implemented this change in commit bce94f6.
But this error is not fixed by using th above suggestion
return a.reshape((1, a.shape[0], a.shape[1]))
IndexError: tuple index out of range

from yolov3.

glenn-jocher avatar glenn-jocher commented on May 22, 2024

@NaumanKhan665
Hello, thank you for your interest in our work! Please note that most technical problems are due to:

  • Your changes to the default repository. If your issue is not reproducible in a fresh git clone version of this repository we can not debug it. Before going further run this code and ensure your issue persists:
sudo rm -rf yolov3  # remove exising repo
git clone https://github.com/ultralytics/yolov3 && cd yolov3 # git clone latest
python3 detect.py  # verify detection
python3 train.py  # verify training (a few batches only)
# CODE TO REPRODUCE YOUR ISSUE HERE
  • Your custom data. If your issue is not reproducible with COCO data we can not debug it. Visit our Custom Training Tutorial for exact details on how to format your custom data. Examine train_batch0.jpg and test_batch0.jpg for a sanity check of training and testing data.
  • Your environment. If your issue is not reproducible in a GCP Quickstart Guide VM we can not debug it. Ensure you meet the requirements specified in the README: Unix, MacOS, or Windows with Python >= 3.7, Pytorch >= 1.1, etc. You can also use our Google Colab Notebook to test your code in working environment.

If none of these apply to you, we suggest you close this issue and raise a new one using the Bug Report template, providing screenshots and minimum viable code to reproduce your issue. Thank you!

from yolov3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.