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

多模態(tài)(紅外,可見光)目標(biāo)檢測

這篇具有很好參考價(jià)值的文章主要介紹了多模態(tài)(紅外,可見光)目標(biāo)檢測。希望對大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

【github】https://github.com/DocF/multispectral-object-detection

一.環(huán)境

1.1 環(huán)境

基本依賴和yolov5基本相同,當(dāng)然也可以配置在虛擬環(huán)境中

git clone https://github.com/DocF/multispectral-object-detection
cd  multispectral-object-detection
pip install -r requirements.txt

1.2 報(bào)錯(cuò)解決

1.2.1 找不到sppf

AttributeError: Can't get attribute 'SPPF' on <module 'models.common' from '/hy-tmp/multispectral-object-detection/models/common.py'>

【參考文章】找不到SPPF錯(cuò)誤
在models/common.py下找到ssp,將下面這段添加到ssp之前

class SPPF(nn.Module):
    def __init__(self, c1, c2, k=5):
        super().__init__()
        c_ = c1 // 2
        self.cv1 = Conv(c1, c_, 1, 1)
        self.cv2 = Conv(c_ * 4, c2, 1, 1)
        self.m = nn.MaxPool2d(kernel_size=k, stride=1, padding=k // 2)
 
    def forward(self, x):
        x = self.cv1(x)
        with warnings.catch_warnings():
            warnings.simplefilter('ignore')
            y1 = self.m(x)
            y2 = self.m(y1)
            return self.cv2(torch.cat([x, y1, y2, self.m(y2)], 1))

1.2.2

RuntimeError: result type Float can't be cast to the desired output type __int64

【參考】報(bào)錯(cuò)解決方法
將下面這段替換utils/loss.py中build_targets函數(shù),注意保留返回值

        for i in range(self.nl):
            anchors, shape = self.anchors[i], p[i].shape
            gain[2:6] = torch.tensor(shape)[[3, 2, 3, 2]]  # xyxy gain
 
            # Match targets to anchors
            t = targets * gain  # shape(3,n,7)
            if nt:
                # Matches
                r = t[..., 4:6] / anchors[:, None]  # wh ratio
                j = torch.max(r, 1 / r).max(2)[0] < self.hyp['anchor_t']  # compare
                # j = wh_iou(anchors, t[:, 4:6]) > model.hyp['iou_t']  # iou(3,n)=wh_iou(anchors(3,2), gwh(n,2))
                t = t[j]  # filter
 
                # Offsets
                gxy = t[:, 2:4]  # grid xy
                gxi = gain[[2, 3]] - gxy  # inverse
                j, k = ((gxy % 1 < g) & (gxy > 1)).T
                l, m = ((gxi % 1 < g) & (gxi > 1)).T
                j = torch.stack((torch.ones_like(j), j, k, l, m))
                t = t.repeat((5, 1, 1))[j]
                offsets = (torch.zeros_like(gxy)[None] + off[:, None])[j]
            else:
                t = targets[0]
                offsets = 0
 
            # Define
            bc, gxy, gwh, a = t.chunk(4, 1)  # (image, class), grid xy, grid wh, anchors
            a, (b, c) = a.long().view(-1), bc.long().T  # anchors, image, class
            gij = (gxy - offsets).long()
            gi, gj = gij.T  # grid indices
 
            # Append
            indices.append((b, a, gj.clamp_(0, shape[2] - 1), gi.clamp_(0, shape[3] - 1)))  # image, anchor, grid
            tbox.append(torch.cat((gxy - gij, gwh), 1))  # box
            anch.append(anchors[a])  # anchors
            tcls.append(c)  # class

二. 數(shù)據(jù)集處理

2.1 數(shù)據(jù)集下載

【github】https://github.com/DocF/multispectral-object-detection包含了對應(yīng)的鏈接

鏈接:https://pan.baidu.com/s/1zO_1Olognq2atY6m4StZUA?pwd=4i77 提取碼:4i77
–來自百度網(wǎng)盤超級會員V1的分享

權(quán)重還有數(shù)據(jù)集全部都打包在這里面了

2.2 數(shù)據(jù)集放置格式

其實(shí)沒有嚴(yán)格的規(guī)定,我的話是這樣:在datasets文件夾下
多模態(tài)(紅外,可見光)目標(biāo)檢測

2.3 數(shù)據(jù)集預(yù)處理成txt

以FLIR(就是那個(gè)align)為例

2.3.1 訓(xùn)練集驗(yàn)證集

split_train_val.py

import os
import random
import argparse

parser = argparse.ArgumentParser()
parser.add_argument('--xml_path', type=str, help='input xml label path')
parser.add_argument('--txt_path', type=str, help='output txt label path')
opt = parser.parse_args()

trainval_percent = 1.0
train_percent = 0.9
xmlfilepath = opt.xml_path
txtsavepath = opt.txt_path
total_xml = os.listdir(xmlfilepath)
if not os.path.exists(txtsavepath):
  os.makedirs(txtsavepath)

num=len(total_xml)
list=range(num)

ftrainval = open(txtsavepath + '/trainval.txt', 'w')
ftest = open(txtsavepath + '/test.txt', 'w')
ftrain = open(txtsavepath + '/train.txt', 'w')
fval = open(txtsavepath + '/val.txt', 'w')

for i in list:
    name=total_xml[i][:-4]+'\n'
    ftrainval.write(name)
    if i%7 == 0:
        fval.write(name)
    else:
        ftrain.write(name)

ftrainval.close()
ftrain.close()
fval.close()
ftest.close()

輸入命令:

python split_train_val.py --xml_path xml文件路徑 --txt_path 輸出txt文件路徑

(1)xml文件路徑:我是先將xml為文件全部放到一個(gè)文件夾里面
以我的為例就是:

cp D:\computervision\cross\detection\align\Annotations\*.xml D:\computervision\cross\detection\align\annotation 

(2)輸出txt文件路徑:直接輸出到前面提到的datasets下
得到下面這四個(gè)
多模態(tài)(紅外,可見光)目標(biāo)檢測

2.3.2 格式轉(zhuǎn)換

voc_label.py文件,應(yīng)該改一下路徑就可以用了,就不多說了

import xml.etree.ElementTree as ET
import pickle
import os
from os import listdir, getcwd
from os.path import join

sets=['train', 'val', 'test']
classes = ['person','car','bicycle']

abs_path = os.getcwd()
def convert(size, box):
    dw = 1./(size[0])
    dh = 1./(size[1])
    x = (box[0] + box[1])/2.0 - 1
    y = (box[2] + box[3])/2.0 - 1
    w = box[1] - box[0]
    h = box[3] - box[2]
    x = x*dw
    w = w*dw
    y = y*dh
    h = h*dh
    return (x,y,w,h)
def convert_annotation(image_id ,RGBid ):
    in_file = open(r'D:\computervision\cross\detection\align\annotation\%s.xml'%( image_id))
    irout_file = open('D:\computervision\cross\detection\multispectral-object-detection-main\datasets\IR\labels\%s.txt'%(image_id), 'w')
    rgbout_file= open('D:\computervision\cross\detection\multispectral-object-detection-main\datasets\RGB\labels\%s.txt'%(RGBid), 'w')
    tree=ET.parse(in_file)
    root = tree.getroot()
    size = root.find('size')
    w = int(size.find('width').text)
    h = int(size.find('height').text)
    for obj in root.iter('object'):
        #difficult = obj.find('difficult').text
        cls = obj.find('name').text
        if cls not in classes :
            continue
        cls_id = classes.index(cls)
        xmlbox = obj.find('bndbox')
        b = (float(xmlbox.find('xmin').text), float(xmlbox.find('xmax').text), float(xmlbox.find('ymin').text), float(xmlbox.find('ymax').text))
        bb = convert((w,h), b)
        irout_file.write(str(cls_id) + " " + " ".join([str(a) for a in bb]) + '\n')
        rgbout_file.write(str(cls_id) + " " + " ".join([str(a) for a in bb]) + '\n')

for image_set in sets:
    # if not os.path.exists('D:\computervision\cross\detection\multispectral-object-detection-main\datasets'):
    #     os.makedirs('D:\computervision\cross\detection\multispectral-object-detection-main\datasets')
    #創(chuàng)建兩個(gè)txt文件
    #(1)先創(chuàng)建rgb文件
    #
    image_ids = open('D:\computervision\cross\detection\multispectral-object-detection-main\datasets\%s.txt'%(image_set)).read().strip().split()
    ir_file = open('D:\computervision\cross\detection\multispectral-object-detection-main\datasets\IR\%s.txt'%(image_set), 'w')
    rgb_file= open('D:\computervision\cross\detection\multispectral-object-detection-main\datasets\RGB\%s.txt'%(image_set), 'w')
    for image_id in image_ids:
        ir_file.write('D:\computervision\cross\detection\multispectral-object-detection-main\datasets\IR\images\%s.jpeg\n'%(image_id))
        id=image_id.split("_")[1]
        RGBid='FLIR_'+id+"_RGB"
        rgb_file.write(
            'D:\computervision\cross\detection\multispectral-object-detection-main\datasets\RGB\images\%s.jpg\n' % (RGBid))

        convert_annotation(image_id,RGBid)
    ir_file.close()
    rgb_file.close()

三 .訓(xùn)練

修改data/multispectral/FLIR_aligned.yaml文件夾

多模態(tài)(紅外,可見光)目標(biāo)檢測
直接

python train.py

多模態(tài)(紅外,可見光)目標(biāo)檢測文章來源地址http://www.zghlxwxcb.cn/news/detail-430716.html

到了這里,關(guān)于多模態(tài)(紅外,可見光)目標(biāo)檢測的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

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

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

相關(guān)文章

  • 熱紅外相機(jī)圖片與可見光圖片配準(zhǔn)教程

    熱紅外相機(jī)圖片與可見光圖片配準(zhǔn)教程

    圖像配準(zhǔn)是一種圖像處理技術(shù),用于將多個(gè)場景對齊到單個(gè)集成圖像中。在這篇文章中,我將討論如何在可見光及其相應(yīng)的熱圖像上應(yīng)用圖像配準(zhǔn)。在繼續(xù)該過程之前,讓我們看看什么是熱圖像及其屬性。 熱圖像本質(zhì)上通常是灰度圖像:黑色物體是冷的,白色物體是熱的,灰

    2024年02月07日
    瀏覽(21)
  • 紅外圖像和可見光圖像異源圖像配準(zhǔn)問題研究

    提示:文章寫完后,目錄可以自動生成,如何生成可參考右邊的幫助文檔 圖像配準(zhǔn)方法有很多,可分為基于灰度的圖像配準(zhǔn)方法和基于特征的圖像配準(zhǔn)方法,其中基于特征的圖像配準(zhǔn)方法是目前圖像配準(zhǔn)算法中常用方法,如尺度不變特征變換(Scale Invariant Feature Transform, SIF

    2023年04月11日
    瀏覽(24)
  • 圖像融合論文閱讀:CrossFuse: 一種基于交叉注意機(jī)制的紅外與可見光圖像融合方法

    圖像融合論文閱讀:CrossFuse: 一種基于交叉注意機(jī)制的紅外與可見光圖像融合方法

    @article{li2024crossfuse, title={CrossFuse: A novel cross attention mechanism based infrared and visible image fusion approach}, author={Li, Hui and Wu, Xiao-Jun}, journal={Information Fusion}, volume={103}, pages={102147}, year={2024}, publisher={Elsevier} } 論文級別:SCI A1 影響因子:18.6 ??[論文下載地址] ??[代碼下載地址] 以往的交

    2024年01月15日
    瀏覽(27)
  • 【圖像融合】小波變換可見光與紅外光圖像融合(帶面板)【含GUI Matlab源碼 701期】

    【圖像融合】小波變換可見光與紅外光圖像融合(帶面板)【含GUI Matlab源碼 701期】

    ?博主簡介:熱愛科研的Matlab仿真開發(fā)者,修心和技術(shù)同步精進(jìn),Matlab項(xiàng)目合作可私信。 ??個(gè)人主頁:海神之光 ??代碼獲取方式: 海神之光Matlab王者學(xué)習(xí)之路—代碼獲取方式 ??座右銘:行百里者,半于九十。 更多Matlab仿真內(nèi)容點(diǎn)擊?? Matlab圖像處理(進(jìn)階版) 路徑規(guī)劃

    2024年02月19日
    瀏覽(32)
  • 【紅外與可見光圖像融合】離散平穩(wěn)小波變換域中基于離散余弦變換和局部空間頻率的紅外與視覺圖像融合方法(Matlab代碼實(shí)現(xiàn))

    【紅外與可見光圖像融合】離散平穩(wěn)小波變換域中基于離散余弦變換和局部空間頻率的紅外與視覺圖像融合方法(Matlab代碼實(shí)現(xiàn))

    ????????? 歡迎來到本博客 ???????? ??博主優(yōu)勢: ?????? 博客內(nèi)容盡量做到思維縝密,邏輯清晰,為了方便讀者。 ?? 座右銘: 行百里者,半于九十。 ?????? 本文目錄如下: ?????? 目錄 ??1 概述 ??2 運(yùn)行結(jié)果 ??3?參考文獻(xiàn) ??4 Matlab代碼及文獻(xiàn) 基于

    2024年02月07日
    瀏覽(19)
  • 圖像融合論文閱讀:CS2Fusion: 通過估計(jì)特征補(bǔ)償圖譜實(shí)現(xiàn)自監(jiān)督紅外和可見光圖像融合的對比學(xué)習(xí)

    圖像融合論文閱讀:CS2Fusion: 通過估計(jì)特征補(bǔ)償圖譜實(shí)現(xiàn)自監(jiān)督紅外和可見光圖像融合的對比學(xué)習(xí)

    @article{wang2024cs2fusion, title={CS2Fusion: Contrastive learning for Self-Supervised infrared and visible image fusion by estimating feature compensation map}, author={Wang, Xue and Guan, Zheng and Qian, Wenhua and Cao, Jinde and Liang, Shu and Yan, Jin}, journal={Information Fusion}, volume={102}, pages={102039}, year={2024}, publisher={Elsevier} } 論文級

    2024年01月22日
    瀏覽(35)
  • ADAS-可見光相機(jī)之Cmos Image Sensor

    ADAS-可見光相機(jī)之Cmos Image Sensor

    “ 可見光相機(jī)在日常生活、工業(yè)生產(chǎn)、智能制造等應(yīng)用有著重要的作用。在ADAS中更是扮演著重要的角色,如tesla model系列全車身10多個(gè)相機(jī),不斷感知周圍世界。本文著重講解下可見光相機(jī)中的CIS(CMOS Image Sensor)?!?光是一種電磁波,自然界的光是由各種波長的電磁波組成,

    2024年02月09日
    瀏覽(26)
  • 【CVPR小目標(biāo)檢測】- ISNet紅外小目標(biāo)檢測

    【CVPR小目標(biāo)檢測】- ISNet紅外小目標(biāo)檢測

    紅外圖像: ???紅外小目標(biāo)使用紅外熱成像技術(shù),使得 紅外目標(biāo)檢測能夠全天候工作 ,可視距離遠(yuǎn),抗干擾能力強(qiáng)。當(dāng)像素距離較遠(yuǎn)時(shí),目標(biāo)所占比例小、亮度低,呈現(xiàn)弱小目標(biāo)。紅外圖像中,弱小目標(biāo)所占像素非常少,特征不明顯、容易被雜波、熱源等噪聲干擾。 貢獻(xiàn)

    2024年02月09日
    瀏覽(18)
  • 目標(biāo)檢測數(shù)據(jù)集:紅外圖像弱小飛機(jī)目標(biāo)檢測數(shù)據(jù)集

    目標(biāo)檢測數(shù)據(jù)集:紅外圖像弱小飛機(jī)目標(biāo)檢測數(shù)據(jù)集

    ??????目標(biāo)檢測數(shù)據(jù)集?????? 本專欄提供各種場景的數(shù)據(jù)集,主要聚焦: 工業(yè)缺陷檢測數(shù)據(jù)集、小目標(biāo)數(shù)據(jù)集、遙感數(shù)據(jù)集、紅外小目標(biāo)數(shù)據(jù)集 ,該專欄的數(shù)據(jù)集會在多個(gè)專欄進(jìn)行驗(yàn)證,在多個(gè)數(shù)據(jù)集進(jìn)行驗(yàn)證mAP漲點(diǎn)明顯, 尤其是小目標(biāo)、遮擋物精度提升明顯

    2024年02月08日
    瀏覽(20)
  • 綜述:自動駕駛中的多模態(tài) 3D 目標(biāo)檢測

    綜述:自動駕駛中的多模態(tài) 3D 目標(biāo)檢測

    在駕駛場景中,自動駕駛車輛需要精準(zhǔn)高效的感知運(yùn)算,時(shí)刻預(yù)測其所處的駕駛環(huán)境。 其中,感知系統(tǒng)將各種傳感器數(shù)據(jù)轉(zhuǎn)化為語義信息,是自動駕駛系統(tǒng)的核心和不可缺少的組成部分。 圖像具有豐富的語義信息,點(diǎn)云包含深度信息。 兩者具有互補(bǔ)特性,可以提高三維物體

    2024年02月03日
    瀏覽(25)

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

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

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

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包