duongttr / vehicles-counting-yolov4-deepsort

A project for counting vehicles using YOLOv4 + DeepSORT + Flask + Ngrok + TF2
MIT License
43 stars 16 forks source link

I Found in this Project /video_feed route will get 500 #1

Closed pokobunhsu closed 2 years ago

pokobunhsu commented 2 years ago

I Found in this Project /video_feed route will get 500

error msg:

Error on request:
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/werkzeug/serving.py", line 323, in run_wsgi
    execute(self.server.app)
  File "/usr/local/lib/python3.7/dist-packages/werkzeug/serving.py", line 314, in execute
    for data in application_iter:
  File "/usr/local/lib/python3.7/dist-packages/werkzeug/wsgi.py", line 506, in __next__
    return self._next()
  File "/usr/local/lib/python3.7/dist-packages/werkzeug/wrappers/base_response.py", line 45, in _iter_encoded
    for item in iterable:
  File "/content/vehicles-counting-yolov4-deepsort/object_tracker_colab.py", line 119, in run
    video_path = pafy.new(self._video).getbest(preftype="mp4").url
  File "/usr/local/lib/python3.7/dist-packages/pafy/pafy.py", line 124, in new
    return Pafy(url, basic, gdata, size, callback, ydl_opts=ydl_opts)
  File "/usr/local/lib/python3.7/dist-packages/pafy/backend_youtube_dl.py", line 31, in __init__
    super(YtdlPafy, self).__init__(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/pafy/backend_shared.py", line 97, in __init__
    self._fetch_basic()
  File "/usr/local/lib/python3.7/dist-packages/pafy/backend_youtube_dl.py", line 54, in _fetch_basic
    self._dislikes = self._ydl_info['dislike_count']
KeyError: 'dislike_count'
duongttr commented 2 years ago

Hi @pokobunhsu, I googled it and know that it is an error from package pafy which helps you get videos from the Youtube platform. A month ago, Youtube announced that they would hide the dislike count, so the package can't get that information from the video (as you can see in the last line of the above error: KeyError: 'dislike_count') . Try this:

!pip uninstall -y pafy # remove current version
!pip install git+https://github.com/Cupcakus/pafy # install from this repo

If this fixes your problem, please let me know.

pokobunhsu commented 2 years ago

Hi @pokobunhsu, I googled it and know that it is an error from package pafy which helps you get videos from the Youtube platform. A month ago, Youtube announced that they would hide the dislike count, so the package can't get that information from the video (as you can see in the last line of the above error: KeyError: 'dislike_count') . Try this:

!pip uninstall -y pafy # remove current version
!pip install git+https://github.com/Cupcakus/pafy # install from this repo

If this fixes your problem, please let me know.

yes,when i change this code. this problem will fixed.

thanks😊