Python Forum
how to solve this problem. IndexError: axis 2 out of bounds [0, 2)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to solve this problem. IndexError: axis 2 out of bounds [0, 2)
#1
hello, i am trying to use the pydlssvm code found on internet but i still getting error on the test_camera file i can not make a real tracking.

actually i am getting this error can someone help me to solve it? also if one of you have a perfect working code of the DLSSVM please send to me

this is my current error
return np.concatenate(layers, axis=2).astype("float64")
IndexError: axis 2 out of bounds [0, 2)
Reply
#2
What is pydlssvm ?

Meanwhile I found myself:
https://github.com/djosix/PyDLSSVM

Your error message means:
   You should use 0 or 1 for axis, not 2.
You should open an issue at https://github.com/djosix/PyDLSSVM, if you think it is an error.
Reply
#3
yes it is that. all the step worked until the last one which is test_camera.py that is not working for me. if you know how to do help me.
Reply
#4
Please, post the entire traceback that you get. We need to see the whole thing. Do not just give us the last line. Take a time to read What to include in a post
Reply
#5
Error:
('tracker.config:', {'search': 1.3, 'rescale': 0.2, 'sv_max': 100, 'Q': 10, 'P': 5, 'step': 2}) Start real-time tracking on camera --------------------------------------- /usr/local/lib/python2.7/dist-packages/skimage/transform/_warps.py:84: UserWarning: The default mode, 'constant', will be changed to 'reflect' in skimage 0.15. warn("The default mode, 'constant', will be changed to 'reflect' in " Traceback (most recent call last): File "/home/soro/eclipse-workspace/MYSSVM.zip_expanded/PyDLSSVM-master/test_camera.py", line 69, in <module> output = tracker.track(frame) File "/home/soro/eclipse-workspace/MYSSVM.zip_expanded/PyDLSSVM-master/dlssvm_tracker/tracker.py", line 76, in track sampler = Sampler(frame, self.target, self.config) File "/home/soro/eclipse-workspace/MYSSVM.zip_expanded/PyDLSSVM-master/dlssvm_tracker/sampler.py", line 22, in __init__ self.features = self._get_features(cropped) File "/home/soro/eclipse-workspace/MYSSVM.zip_expanded/PyDLSSVM-master/dlssvm_tracker/sampler.py", line 80, in _get_features return np.concatenate(layers, axis=2).astype("float64") IndexError: axis 2 out of bounds [0, 2)
Reply
#6
Error:
/usr/local/lib/python2.7/...
The demo from github needs Python 3.x:
python3 test_camera.py
Reply
#7
ok i set the python command to python3.5 and chose python3 for the interpreter in pydev in eclipse and it termited without error but northing
tracker.config: {'search': 1.3, 'step': 2, 'sv_max': 100, 'Q': 10, 'rescale': 0.2, 'P': 5}
Start real-time tracking on camera
---------------------------------------
Reply
#8
i have tried to understand why it was not working. and i think now the problem is from python3 because i am using opencv 3.3 and i can read video with interpreter fixed on python2 but when i compile with python3 it gave me norming it just terminate here is an example of code supose to work with python3 but it does not
import numpy as np
import cv2


 
cap = cv2.VideoCapture(0)
 
while(cap.isOpened()):  # check !
    # capture frame-by-frame
    ret, frame = cap.read()
 
    if ret: # check ! (some webcam's need a "warmup")
        # our operation on frame come here
        gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
 
        # Display the resulting frame
        cv2.imshow('frame', gray)
 
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break
# When everything is done release the capture
cap.release()
cv2.destroyAllWindows()
maybe if i can make this code work it will be the same for the tracking project.
Reply
#9
Keep me uptodate.
Reply
#10
i tried the same code on my laptop and it work fine without any modification and no eror. i think it should be my desktop which have problem
thank you
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to solve this problem Python configuration? magomes 5 432 Mar-22-2024, 11:11 PM
Last Post: magomes
  How to solve problem 1181 of the URI with numpy. thiagohps 4 2,678 Mar-22-2021, 04:11 PM
Last Post: buran
Star Interesting Intro to python problem I can't solve. Honestworker 5 12,299 Mar-04-2021, 02:05 AM
Last Post: BashBedlam
  solve probability problem by python Dreammer 1 1,847 Dec-24-2020, 09:51 AM
Last Post: Larz60+
  Algorithm to solve a case of Travelling Salesman Problem Ale888 3 3,016 Dec-11-2018, 07:49 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020