国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

解決報(bào)錯(cuò)ValueError: not enough values to unpack (expected 3, got 2)

這篇具有很好參考價(jià)值的文章主要介紹了解決報(bào)錯(cuò)ValueError: not enough values to unpack (expected 3, got 2)。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問(wèn)。

解決報(bào)錯(cuò)ValueError: not enough values to unpack (expected 3, got 2)

錯(cuò)誤提示:
Traceback (most recent call last):
  File "E:/workspace/code/detect/ShapeDetect.py", line 86, in <module>
    ld.analysis(src)
  File "E:/workspace/code/detect/ShapeDetect.py", line 18, in analysis
    out_binary, contours, hierarchy = cv.findContours(binary, cv.RETR_EXTERNAL, cv.CHAIN_APPROX_SIMPLE)  #
ValueError: not enough values to unpack (expected 3, got 2)


進(jìn)程已結(jié)束,退出代碼為 1

在使用opencv進(jìn)行關(guān)鍵點(diǎn)識(shí)別、邊緣輪廓提取的時(shí)候,提示以上錯(cuò)誤,報(bào)錯(cuò)原因是函數(shù)定義的返回值數(shù)量和調(diào)用函數(shù)時(shí)實(shí)際賦予的返回值數(shù)量不一致。導(dǎo)致這個(gè)問(wèn)題,實(shí)際是因?yàn)閛pencv版本不一致引起的,新版opencv(opencv4)在調(diào)用findContours時(shí)只需要兩個(gè)參數(shù),需要?jiǎng)h掉第一個(gè)參數(shù)(本文中錯(cuò)誤行代碼的out_binary),只需要?jiǎng)h除一個(gè)參數(shù)就可以完美解決;opencv3需要三個(gè)參數(shù),修改運(yùn)行環(huán)境,使用opencv3.6也可解決。

解決方法
方法1

刪除第一個(gè)參數(shù),即代碼改為:
contours, hierarchy = cv.findContours(binary, cv.RETR_EXTERNAL, cv.CHAIN_APPROX_SIMPLE)

方法2

修改opencv版本,降至opencv3文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-504232.html

到了這里,關(guān)于解決報(bào)錯(cuò)ValueError: not enough values to unpack (expected 3, got 2)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來(lái)自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • ValueError:too many values to unpack (expected 2)

    【學(xué)習(xí)參考】:成功解決ValueError:too many values to unpack (expected 2)_叫我李嘉圖的博客-CSDN博客 ValueError: too many values to unpack (expected 3)_歸來(lái)-依舊-是-少年的博客-CSDN博客 解決思路: (1).首先理解錯(cuò)誤類型: ValueError–ValueError:函數(shù)或方法雖然接受了正確的【類型】的參數(shù),但是該參數(shù)

    2024年02月12日
    瀏覽(31)
  • 規(guī)避ValueError:too many values to unpack (expected 2)錯(cuò)誤

    之前我也寫過(guò)有關(guān)這個(gè)錯(cuò)誤的文章,但不是單獨(dú)開的,今天單獨(dú)開以便來(lái)者更快解決問(wèn)題 ??錯(cuò)誤示例: dict指的是字典 解析:ValueError:too many values to unpack (expected 2) ?????很明顯:出錯(cuò)的在?v?這個(gè)值上.可能是出于值不是一個(gè)簡(jiǎn)單的數(shù)據(jù)類型,比如值是一個(gè)字典,元組,或者更復(fù)雜的嵌

    2024年02月13日
    瀏覽(20)
  • ValueError: Expected more than 1 value per channel when training, got input size torch.Size([1, 128]

    因?yàn)橛玫搅薆atchNorm,所以batch_size要大于1,drop_last 參數(shù)設(shè)置為True。 如果是兩個(gè)GPU訓(xùn)練,batch_size改為4。 參考 ValueError: Expected more than 1 value per channel when training, got input size [1, 16, 1, 1](解決方案) Pytorch遇到報(bào)錯(cuò)Expected more than 1 value per channel when training, got input size torch.Size

    2024年01月16日
    瀏覽(26)
  • 【Python】成功解決ValueError: could not convert string to float: ‘ ignoring input‘

    【Python】成功解決ValueError: could not convert string to float: ‘ ignoring input‘

    【Python】成功解決ValueError: could not convert string to float: ’ ignoring input’ ?? 個(gè)人主頁(yè):高斯小哥 ?? 高質(zhì)量專欄:Matplotlib之旅:零基礎(chǔ)精通數(shù)據(jù)可視化、Python基礎(chǔ)【高質(zhì)量合集】、PyTorch零基礎(chǔ)入門教程?? 希望得到您的訂閱和支持~ ?? 創(chuàng)作高質(zhì)量博文(平均質(zhì)量分92+),分享更

    2024年04月15日
    瀏覽(28)
  • 解決:python+appium報(bào)錯(cuò)ValueError: Timeout value connect was <...>, but it must be an int, float or None.

    解決:python+appium報(bào)錯(cuò)ValueError: Timeout value connect was <...>, but it must be an int, float or None.

    pip install --force-reinstall -v \\\"selenium==4.8.0\\\" 參考: python - Running an keyword on Robotframework throw an error: ValueError: Timeout value connect was object object at 0x106cc5b50 - Stack Overflow ValueError: Timeout value connect was object object at 0x7f7515f84420, but it must be an int, float or None. · Issue #863 · appium/python-client

    2024年02月11日
    瀏覽(24)
  • DefaultCPUAllocator: not enough memory: you tried to allocate

    DefaultCPUAllocator: not enough memory: you tried to allocate

    DefaultCPUAllocator: not enough memory: you tried to allocate XXX 問(wèn)題:系統(tǒng)內(nèi)存不足。 解決方案(1):重啟電腦/使用任務(wù)管理器關(guān)閉多余應(yīng)用釋放系統(tǒng)內(nèi)存(臨時(shí)方案) 任務(wù)管理器啟用方式:ctrl+alt+del 到達(dá)進(jìn)程頁(yè)面-右鍵進(jìn)程結(jié)束任務(wù) 解決方案(2):增加電腦虛擬內(nèi)存(建議選該方案

    2024年02月12日
    瀏覽(21)
  • pandas字段分列遇到ValueError: Length of values does not match length of index

    在使用pandas針對(duì)字段進(jìn)行分列時(shí)遇到這個(gè)問(wèn)題,ValueError: Length of values does not match length of index。 問(wèn)題描述 例如:針對(duì)字段進(jìn)行分列 data[\\\'time\\\']?=?data[\\\'time\\\'].astype(str) data[\\\'day\\\']?=?data[\\\'time\\\'].str.split(\\\"?\\\")[0] data[\\\'hour\\\']?=?data[\\\'time\\\'].str.split(\\\"?\\\")[1] 原來(lái)是語(yǔ)句寫錯(cuò)了,這里只需要改成:

    2023年04月12日
    瀏覽(22)
  • RuntimeError: DefaultCPUAllocator: not enough memory: you tried to allocate 1105920 bytes.

    RuntimeError: DefaultCPUAllocator: not enough memory: you tried to allocate 1105920 bytes.

    問(wèn)題 RuntimeError: [enforce fail at ..c10coreCPUAllocator.cpp:76] data. DefaultCPUAllocator: not enough memory: you tried to allocate 1105920 bytes. 今天在使用自己電腦跑YOLOV7的時(shí)候,因?yàn)樽约簺](méi)有GPU所以使用CPU來(lái)跑測(cè)試模型,使用CPU來(lái)進(jìn)行一張獨(dú)立的圖像進(jìn)行預(yù)測(cè),跑一張圖像完全沒(méi)有問(wèn)題,非常的ni

    2023年04月13日
    瀏覽(24)
  • 解決pytorch報(bào)錯(cuò)——RuntimeError: Expected to have finished reduction in the prior iteration...

    解決pytorch報(bào)錯(cuò)——RuntimeError: Expected to have finished reduction in the prior iteration...

    之前寫代碼時(shí)碰到了這樣一個(gè)錯(cuò)誤: RuntimeError: Expected to have finished reduction in the prior iteration before starting a new one. This error indicates that your module has parameters that were not used in producing loss. You can enable unused parameter detection by (1) passing the keyword argument find_unused_parameters=True to torch.nn.pa

    2023年04月17日
    瀏覽(19)
  • 報(bào)錯(cuò)解決ValueError: did not find a match in any of xarray‘s currently installed IO backends

    報(bào)錯(cuò)解決ValueError: did not find a match in any of xarray‘s currently installed IO backends

    最近在服務(wù)器上配置環(huán)境遇到了xarray讀取nc數(shù)據(jù)的相關(guān)問(wèn)題,折騰了一下午終于解決了,記錄下來(lái),希望幫助后來(lái)人。具體報(bào)錯(cuò)如下 想要解決該問(wèn)題只需要 兩步: 【1】下載相關(guān)依賴包 ??????? 可以發(fā)現(xiàn)已經(jīng)明顯提示了 缺少IO backends ,可到給出的網(wǎng)址中尋求解答。

    2024年02月02日
    瀏覽(202)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包