日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > c/c++ >内容正文

c/c++

tensorflow-yolov3 调试Intel Realsense D435摄像头所遇到的问题(USB自动检测并重置机制)hardware_reset() pyusb libusb devcon

發布時間:2025/3/19 c/c++ 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 tensorflow-yolov3 调试Intel Realsense D435摄像头所遇到的问题(USB自动检测并重置机制)hardware_reset() pyusb libusb devcon 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

文章目錄

      • 191126
      • 191127
      • 191128
      • 191129
        • 嘗試第二種方案 Devcon
      • 191130

191126

連接6攝像頭運行,開始運行正常,能夠正常識別,但不小心線動了一下,視頻窗口卡死,報錯runtime error:

Traceback (most recent call last):File "D:/20191031_tensorflow_yolov3/tensorflow-yolov3/test-使用locals()函數批量配置攝像頭運行識別程序并畫框.py", line 206, in <module>YoloTest().dontla_evaluate_detect()File "D:/20191031_tensorflow_yolov3/tensorflow-yolov3/test-使用locals()函數批量配置攝像頭運行識別程序并畫框.py", line 141, in dontla_evaluate_detectfor i in ctx.devices: RuntimeError

后來添加了打印已連接攝像頭個數的代碼和打印攝像頭序列號和接口號的代碼,打印如下:


可看到,攝像頭個數為6個,但打印第六個序列號時卻未能正常打印

已經在官方github下提問了,等待消息
RuntimeError #5329

趁他們還未回復,先自己折騰一陣。

參考文章1:How do you reset a USB device from the command line?

參考文章2:python3 自動識別usb連接狀態,即對usb重連的判斷方法

無果。。。

191127

又繼續測試這個:usb之python(pyusb)

#!/usr/bin/python # -*- coding:utf-8 -*- import usb.util import sys #USB\VID_1C4F&PID_0051 dev = usb.core.find(idVendor= 0x1C4F, idProduct= 0x0051) if dev is None:raise ValueError('Device not found') print(dev) # set the active configuration. With no arguments, the first # configuration will be the active onecfg = dev.get_active_configuration()

運行后報錯:

File "D:/20191031_tensorflow_yolov3/needed/test/test_Intel_realsense/test_191127_測試usb(已知攝像頭序列號).py", line 13, in <module>dev = usb.core.find(idVendor=0x1C4F, idProduct=0x0051)File "D:\20191031_tensorflow_yolov3\python\lib\site-packages\usb\core.py", line 1263, in findraise NoBackendError('No backend available') usb.core.NoBackendError: No backend availableProcess finished with exit code 1

參考Pyusb on windows 8.1 - no backend available - how to install libusb?

后來安裝了pyusb庫,還是沒法運行,想放棄了。。。

還是按照他的解釋從 http://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-1.0.20/libusb-1.0.20.7z/download 下載了libusb-1.0.20.7z,解壓然后拷貝一些文件:

I downloaded latest libusb windows binaries from here: http://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-1.0.20/libusb-1.0.20.7z/download then I copied libusb1.dll according to this: when you are on 64-bit Windows, MS64\dll\libusb-1.0.dll must be copied into C:\Windows\System32 and (for running 32-bit applications that use libusb) MS32\dll\libusb-1.0.dll must be copied into C:\Windows\SysWOW64. and then I copied libusb1.lib from binaries to lib dir in python directory and now pyusb works for me. hope it helps.

我從此處下載了最新的libusb Windows二進制文件:http://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-1.0.20/libusb-1.0.20.7z/download,然后根據此文件復制了libusb1.dll。 :在64位Windows上時,必須將MS64 \ dll \ libusb-1.0.dll復制到C:\ Windows \ System32和(對于運行使用libusb的32位應用程序)MS32 \ dll \ libusb-1.0.dll 必須復制到C:\ Windows \ SysWOW64。 然后將libusb1.lib從二進制文件復制到python目錄中的lib dir,現在pyusb對我有用。 希望能幫助到你。



發現可以運行了,但是報錯ValueError: Device not found:

191128

后續內容參考這個吧:python pyusb庫使用教程【在window10系統上操作USB】(操作Intel Realsense D435)

看到這個,有點啟發:
How to restart USB device(如何重啟USB設備)
看看python是否能夠調用設備控制臺DevCon(Devcon.exe)【先掛起不管】

又看到這個,usb 設備 復位,作者在最后提到了libusb,遂下,libusb 1.0.22b8 ,將之前老版本的libusb刪除,包括system32里的等等,但是這個貌似不太友好,找了半天也沒找到教程在哪,只有這個:A cross-platform user library to access USB devices

確實太不友好了,看見github上有個libusb1,看看那個是咋回事

貌似,使用python libusb1庫也蛋疼,還是重新回到librealsense去找重置usb的答案吧。。。

191129

提問后,Intel Realsense 官方客服人員MartyG小姐給出了回答,https://github.com/IntelRealSense/librealsense/issues/5345#issuecomment-559583087,讓我參考這個#3329 (comment):

ctx = rs.context() devices = ctx.query_devices() for dev in devices:dev.hardware_reset()

試了一下,還是不行,沒法重置:

嘗試第二種方案 Devcon

How to restart USB device(如何重啟USB設備),嘗試使用Devcon.exe工具

如何安全的下載Devcon.exe文件

下好后(要根據系統版本號下載哦),解壓到一個文件夾里:


右鍵以管理員身份運行控制臺:

參考這里輸入命令:Devcon的用法

具體測試結果,請見:devcon的測試 嘗試使用devcon命令重置Intel Realsense D435攝像頭

發現使用devcon重啟也還是不行,有一個攝像頭都地址設定失敗了。。。不知道怎么把它弄回來?


程序中也是,只要一遍歷訪問信息就會出錯。。。

沒辦法,看來還是得啟用PCIE了:
20190812_Intel Realsense D435 關于攝像頭USB掉線問題問題匯總

191130

設置了hardware_reset()并設置了重置后的睡眠時間為5秒,但運行時還是報錯了:

D:\20191031_tensorflow_yolov3\python\python.exe D:/20191031_tensorflow_yolov3/tensorflow-yolov3/test-multicam.py 2019-11-30 12:46:21.906107: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 2019-11-30 12:46:22.838489: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1411] Found device 0 with properties: name: GeForce GTX 1080 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.6575 pciBusID: 0000:0e:00.0 totalMemory: 11.00GiB freeMemory: 9.10GiB 2019-11-30 12:46:22.996493: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1411] Found device 1 with properties: name: GeForce GT 710 major: 3 minor: 5 memoryClockRate(GHz): 0.954 pciBusID: 0000:05:00.0 totalMemory: 2.00GiB freeMemory: 1.67GiB 2019-11-30 12:46:22.997060: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1461] Ignoring visible gpu device (device: 1, name: GeForce GT 710, pci bus id: 0000:05:00.0, compute capability: 3.5) with Cuda compute capability 3.5. The minimum required Cuda capability is 3.7. 2019-11-30 12:46:22.997586: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1490] Adding visible gpu devices: 0 2019-11-30 12:46:24.450762: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971] Device interconnect StreamExecutor with strength 1 edge matrix: 2019-11-30 12:46:24.451066: I tensorflow/core/common_runtime/gpu/gpu_device.cc:977] 0 1 2019-11-30 12:46:24.451246: I tensorflow/core/common_runtime/gpu/gpu_device.cc:990] 0: N N 2019-11-30 12:46:24.451422: I tensorflow/core/common_runtime/gpu/gpu_device.cc:990] 1: N N 2019-11-30 12:46:24.451754: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1103] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 8789 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1080 Ti, pci bus id: 0000:0e:00.0, compute capability: 6.1) 攝像頭838212073161重置成功 攝像頭836612072369重置成功 攝像頭827312071726重置成功 攝像頭838212073249重置成功 攝像頭827312070790重置成功 攝像頭826212070395重置成功 攝像頭個數:6 serial number 1838212073161;usb port:3.2 serial number 2836612072369;usb port:2.1 serial number 3827312071726;usb port:3.2 serial number 4838212073249;usb port:3.2 serial number 5827312070790;usb port:3.2 serial number 6826212070395;usb port:3.2 Traceback (most recent call last):File "D:/20191031_tensorflow_yolov3/tensorflow-yolov3/test-multicam.py", line 241, in <module>YoloTest().dontla_evaluate_detect()File "D:/20191031_tensorflow_yolov3/tensorflow-yolov3/test-multicam.py", line 174, in dontla_evaluate_detectlocals()['pipeline' + str(i)].start(locals()['config' + str(i)]) RuntimeErrorProcess finished with exit code 1

然后給重置程序加了多重延時,希望不再報錯:

總結

以上是生活随笔為你收集整理的tensorflow-yolov3 调试Intel Realsense D435摄像头所遇到的问题(USB自动检测并重置机制)hardware_reset() pyusb libusb devcon的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。