Giter Site home page Giter Site logo

Error how can i resolve it about learnopencv HOT 14 OPEN

Tech3467 avatar Tech3467 commented on June 3, 2024
Error how can i resolve it

from learnopencv.

Comments (14)

brmarkus avatar brmarkus commented on June 3, 2024

Can you provide more details, please?
Which sample, which file(s) are you working with and see the compilation problem? Are you following a blog from "Learn-OpenCV", if yes, which?
Do you have more console output?

It looks like you need to install "http://torch.ch/".

from learnopencv.

brmarkus avatar brmarkus commented on June 3, 2024

So you are running this JupyterNotebook, "https://github.com/spmallick/learnopencv/blob/master/Object-Tracking-and-Reidentification-with-FairMOT/Tracking_using_FairMOT.ipynb", right?

Are you sure you have executed the second cell, and it finished successfully?

# Clone the FairMOT repository, and instell the required libraries.
!git clone https://github.com/ifzhang/FairMOT.git
!pip install torch==1.7.0 torchvision==0.8.0
!pip install cython
!pip install -r FairMOT/requirements.txt

It installs "torch" (in version v1.7.0), which contains the header "TH/TH.h".

from learnopencv.

brmarkus avatar brmarkus commented on June 3, 2024

Can you provide more details, please?
Is there a chance that you can share what results you get from each cell?

If you open "https://github.com/spmallick/learnopencv/blob/master/Object-Tracking-and-Reidentification-with-FairMOT/Tracking_using_FairMOT.ipynb" in a separate browser window in parallel to what you are running in your Colab environment?

Which of the cells look different?
The original version of this JupyterNotebook is more than 2 years old... your environment might have newer versions of some of the components; not all dependencies in this JupyterNotebook has an explicit version number...

from learnopencv.

brmarkus avatar brmarkus commented on June 3, 2024

Yes i am running this code no this line doesnt exectued .updated version is downloaded not this one

Can you provide more details, please?

Which line do you mean, can you split the multiple lines into separate lines and execute each line separately - and then show the results you are getting?

from learnopencv.

brmarkus avatar brmarkus commented on June 3, 2024

From e.g. "https://pypi.org/pypi/torch/json", a recent version seems to be "2.2.2".

$>pip index versions torch
torch (2.2.2)
Available versions: 2.2.2, 2.2.1, 2.2.0, 2.1.2, 2.1.1, 2.1.0, 2.0.1, 2.0.0, 1.13.1, 1.13.0, 1.12.1, 1.12.0, 1.11.0, 1.10.2, 1.10.1, 1.10.0, 1.9.1, 1.9.0, 1.8.1, 1.8.0, 1.7.1

As the code of this sample is old, don't try the latest version.

Try with e.g.

!pip install torch==1.7.1

from learnopencv.

ajax619 avatar ajax619 commented on June 3, 2024

Any solution as i am encountering same problem

from learnopencv.

brmarkus avatar brmarkus commented on June 3, 2024

Can you provide more details, please? The same missing header-file?
Where you able to install an older version (the notebook is quite old, there were a lot of updates to the dependencies in the meantime).

from learnopencv.

brmarkus avatar brmarkus commented on June 3, 2024

I needed to modify a few cells:

remove version numbers:

# Clone the FairMOT repository, and instell the required libraries.
!git clone https://github.com/ifzhang/FairMOT.git
!pip install torch torchvision
!pip install cython
!pip install -r FairMOT/requirements.txt

and

using a different repo and different branch name:

# Clone and install DCNv2.
%cd /content/FairMOT
%rm -rf /content/FairMOT/DCNv2
!git clone -b pytorch_2.0.1 https://github.com/lbin/DCNv2
%cd /content/FairMOT/DCNv2
!chmod +x ./make.sh
!./make.sh

import sys
sys.path.append('/content/FairMOT/DCNv2')

and

comment-out a download (doesn't exist anylonger):

# Download all the trained FairMOT models.
!mkdir -p /content/FairMOT/models
%cd /content/FairMOT/models/
!gdown --fuzzy https://drive.google.com/file/d/1MEvsRPyoAqYSCdKaS5Ofrl7ZfKbBZ1Jb/view
!gdown --fuzzy https://drive.google.com/file/d/1HVzDTrYSSZiVqExqG9rou3zZXX1-GGQn/view
!gdown --fuzzy https://drive.google.com/file/d/1dJDGSa6-FMq33XY-cOd_nYxuilv30YDM/view
!gdown --fuzzy https://drive.google.com/file/d/1SFOhg_vos_xSYHLMTDGFVZBYjo8cr2fG/view
!gdown --fuzzy https://drive.google.com/file/d/1iqRQjsG9BawIl8SlFomMg5iwkb6nqSpi/view
#!gdown --fuzzy https://drive.google.com/file/d/1pl_-ael8wERdUREEnaIfqOV_VF2bEVRT/view
!gdown --fuzzy https://drive.google.com/file/d/1Ur3_pa9r3KRY-5qM2cdFhFJ5exghRJvh/view

How far do you get with those changes?

from learnopencv.

brmarkus avatar brmarkus commented on June 3, 2024

(I needed to apply some smaller modifications inside two Python files in FairMOT/src/lib/tracker/ due to numpy deprecated the type np.float; so wherever np.float was used in the sources I changed it to np.double)
(the used video file consists of 1500 frames; processing all frames in Google colab can take quite a long time... processing at around 9fps...)

(when changing files used in the Jupyter notebook, then I needed to restart the Google colab runtime manually so that the modified Python files would be used)

Inside the Google Colab notebook I modified these files:
from FairMOT: "src/lib/tracker/matching.py" and "src/lib/tracker/multitracker.py" (cloned https://github.com/ifzhang/FairMOT/blob/master/src/lib/tracker/matching.py and
https://github.com/ifzhang/FairMOT/blob/master/src/lib/tracker/multitracker.py)
=> every np.float I changed to np.double

The files can be opened and modified inside the colab.

from learnopencv.

brmarkus avatar brmarkus commented on June 3, 2024

I'm getting this, finally:

INFO:root:Starting tracking...
2024-05-30 15:34:06 [INFO]: Starting tracking...
Fix size testing.
training chunk_sizes: [6, 6]
The output will be saved to  /content/FairMOT/src/lib/../../exp/mot/default
heads {'hm': 1, 'wh': 4, 'id': 128, 'reg': 2}
Lenth of the video: 1500 frames
Creating model...
loaded /content/FairMOT/models/fairmot_dla34.pth, epoch 30
INFO:root:Processing frame 0 (100000.00 fps)
2024-05-30 15:34:07 [INFO]: Processing frame 0 (100000.00 fps)
INFO:root:Processing frame 20 (7.88 fps)
... ...
INFO:root:Processing frame 1460 (9.00 fps)
2024-05-30 15:39:43 [INFO]: Processing frame 1460 (9.00 fps)
INFO:root:Processing frame 1480 (9.00 fps)
2024-05-30 15:39:48 [INFO]: Processing frame 1480 (9.00 fps)
INFO:root:save results to /content/FairMOT/tests/MOT16-03.txt
2024-05-30 15:39:53 [INFO]: save results to /content/FairMOT/tests/MOT16-03.txt

Every frame gets the bounding boxes drawn into it.
First processed frame looks like this:
image

The file "/content/FairMOT/tests/MOT16-03.txt" starts like this:

1,1,493.5321350097656,68.95755004882812,60.27572631835937,165.18722534179688,1,-1,-1,-1
1,2,727.6353759765625,639.0201416015625,101.7655029296875,239.0374755859375,1,-1,-1,-1
1,3,1843.5057373046875,541.5244750976562,76.12744140625,202.57000732421875,1,-1,-1,-1
1,4,1576.8380126953125,237.37307739257812,65.1553955078125,189.41873168945312,1,-1,-1,-1
1,5,1798.78857421875,203.35467529296875,60.578369140625,173.3404541015625,1,-1,-1,-1
1,6,1314.087158203125,480.53668212890625,81.9610595703125,221.36370849609375,1,-1,-1,-1
1,7,54.18689727783203,603.6111450195312,82.54642486572266,231.30126953125,1,-1,-1,-1
1,8,1007.3807373046875,58.848365783691406,69.66015625,189.54800415039062,1,-1,-1,-1
1,9,983.64697265625,317.5620422363281,74.702880859375,200.46499633789062,1,-1,-1,-1
1,10,521.401611328125,163.27479553222656,60.09906005859375,166.3485870361328,1,-1,-1,-1
1,11,876.5536499023438,110.1990966796875,61.20794677734376,157.6925048828125,1,-1,-1,-1
... ...

from learnopencv.

brmarkus avatar brmarkus commented on June 3, 2024

This Jupyter notebook (its used dependencies) need some updates to get it working again, now in the year 2024... it was created long time ago and with the dependencies outdated in the meantime...

from learnopencv.

Tech3467 avatar Tech3467 commented on June 3, 2024
Screenshot 2024-05-31 102230 2 i am encountring this error at the last line

from learnopencv.

brmarkus avatar brmarkus commented on June 3, 2024

Looks like something went wrong cloning the repo "https://github.com/ifzhang/FairMOT/" in cell number 2:

# Clone the FairMOT repository, and instell the required libraries.
!git clone https://github.com/ifzhang/FairMOT.git

The method LoadVideo can be found in the repo here: "https://github.com/ifzhang/FairMOT/blob/master/src/lib/datasets/dataset/jde.py#L86"

Have you applied changes to files (or deleted, moved, renamed files&folders) and repos in your notebook environment (locally? Google-Colab?)?
You might need to start with a fresh environment.
If you run cells multiple times, then e.g. Git doesn't clone the repo again (error message like "there is already a non-empty-folder").

You might need to add a "delete folder" instruction to the cells which clone repos, e.g.

# Clone the FairMOT repository, and instell the required libraries.
!rm -rf FairMOT
!git clone https://github.com/ifzhang/FairMOT.git
... ...

from learnopencv.

brmarkus avatar brmarkus commented on June 3, 2024

You might try a more recent implementation... this notebook's dependencies need some updates...

You might try something like this:

from learnopencv.

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.