第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

Android 上的 OpenCV:net.forward 產(chǎn)生“215 斷言失敗”

Android 上的 OpenCV:net.forward 產(chǎn)生“215 斷言失敗”

楊魅力 2023-05-24 15:18:45
因 net.forward 上的斷言失敗而崩潰,我無(wú)法在其他任何地方解決/找到。認(rèn)為這個(gè)問(wèn)題看起來(lái)很相似,并試圖通過(guò)修復(fù)/問(wèn)題發(fā)現(xiàn)。然而,重新開(kāi)始討論和試驗(yàn)表明它可能不一樣。我最初使用的是 3.4.3,它以某種方式不支持相同的 Mat 類(lèi)型。現(xiàn)在更新到 3.4.7,可以確認(rèn) blob 大小沒(méi)問(wèn)題(從圖像生成)。還嘗試了其他各種 prototxt 和 caffemodels,但現(xiàn)在懷疑問(wèn)題出在那里(如果文件沒(méi)問(wèn)題就可以工作,否則網(wǎng)絡(luò)加載失?。?。關(guān)鍵代碼應(yīng)該是這樣的:// Load a network.public void onCameraViewStarted(int width, int height) {? ? String proto = getPath("deploy.prototxt", this);? ? String weights = getPath("MobileNetSSD_deploy.caffemodel", this);? ? net = Dnn.readNetFromCaffe(proto, weights);? ? Log.i(TAG, "Network loaded successfully");}public Mat onCameraFrame(CvCameraViewFrame inputFrame) {? ? // Get a new frame? ? Mat frame = inputFrame.rgba();? ? Imgproc.cvtColor(frame, frame, Imgproc.COLOR_RGBA2RGB);? ? // Forward image through network.? ? Mat blob = Dnn.blobFromImage(frame, 0.007843,? ? ? ? ? ? new Size(300, 300),? ? ? ? ? ? new Scalar(127.5, 127.5, 127.5));? ? net.setInput(blob);? ? Mat detections = net.forward(); //***215 ASSERTION FAILED occurs***? ? int cols = frame.cols();? ? int rows = frame.rows();? ? detections = detections.reshape(1, (int)detections.total() / 7);? ? for (int i = 0; i < detections.rows(); ++i) {? ? ? ? double confidence = detections.get(i, 2)[0];? ? ? ? if (confidence > 0.2) {? ? ? ? ? ? int classId = (int)detections.get(i, 1)[0];? ? ? ? ? ? int left? ?= (int)(detections.get(i, 3)[0] * cols);? ? ? ? ? ? int top? ? = (int)(detections.get(i, 4)[0] * rows);? ? ? ? ? ? int right? = (int)(detections.get(i, 5)[0] * cols);? ? ? ? ? ? int bottom = (int)(detections.get(i, 6)[0] * rows);? ? ? ? }? ? }? ? return frame;}完整的錯(cuò)誤信息是cv::Exception: OpenCV(3.4.7) /build/3_4_pack-android/opencv/modules/dnn/src/layers/batch_norm_layer.cpp:39: 錯(cuò)誤: (-215:斷言失敗) blobs.size() >= 2 在函數(shù) 'cv::dnn::BatchNormLayerImpl::BatchNormLayerImpl(const cv::dnn::experimental_dnn_34_v13::LayerParams&)'我希望它不會(huì)崩潰。框架應(yīng)該沒(méi)問(wèn)題(圖像已加載),網(wǎng)絡(luò)不是空的,網(wǎng)絡(luò)中的層看起來(lái)也很好(已檢查,因?yàn)樵?java 中使用 caffe 存在一些差異)。任何幫助表示贊賞!
查看完整描述

1 回答

?
溫溫醬

TA貢獻(xiàn)1752條經(jīng)驗(yàn) 獲得超4個(gè)贊

幀格式應(yīng)該是 BGR,而不是 RGB!這意味著

Imgproc.cvtColor(frame,?frame,?Imgproc.COLOR_RGBA2BGR);


查看完整回答
反對(duì) 回復(fù) 2023-05-24
  • 1 回答
  • 0 關(guān)注
  • 294 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)