国产亚洲精品福利在线无卡一,国产精久久一区二区三区,亚洲精品无码国模,精品久久久久久无码专区不卡

當前位置: 首頁 > news >正文

把網(wǎng)站傳到服務(wù)器上怎么做友情鏈接怎么交換

把網(wǎng)站傳到服務(wù)器上怎么做,友情鏈接怎么交換,網(wǎng)站源碼上傳到空間以后怎么做,金山集團網(wǎng)站建設(shè)一、概述 數(shù)據(jù)增強是一種通過人工或自動方式對數(shù)據(jù)進行修改或變換,以增加數(shù)據(jù)集規(guī)模和多樣性的技術(shù)。在機器學(xué)習(xí)中,數(shù)據(jù)增強被廣泛應(yīng)用于解決數(shù)據(jù)稀缺、數(shù)據(jù)不平衡、數(shù)據(jù)噪聲等問題,提高模型的泛化能力和魯棒性。 二、為什么需要數(shù)據(jù)增強 …

一、概述

數(shù)據(jù)增強是一種通過人工或自動方式對數(shù)據(jù)進行修改或變換,以增加數(shù)據(jù)集規(guī)模和多樣性的技術(shù)。在機器學(xué)習(xí)中,數(shù)據(jù)增強被廣泛應(yīng)用于解決數(shù)據(jù)稀缺、數(shù)據(jù)不平衡、數(shù)據(jù)噪聲等問題,提高模型的泛化能力和魯棒性。

二、為什么需要數(shù)據(jù)增強

圖像增強在深度學(xué)習(xí)卷積神經(jīng)網(wǎng)絡(luò) (CNN) 背景下至關(guān)重要,因為它有助于滿足有效模型訓(xùn)練對大型且多樣化數(shù)據(jù)集的需求。 CNN 需要大量圖像才能有效訓(xùn)練,而圖像增強提供了一種人為擴展現(xiàn)有數(shù)據(jù)集的方法。通過縮放、旋轉(zhuǎn)、剪切或裁剪等技術(shù)創(chuàng)建圖像變化,圖像增強有助于生成更全面的可能圖像集。這種多樣化的數(shù)據(jù)集使模型能夠更好地泛化,減少過度擬合,并在測試或驗證過程中對以前未見過的數(shù)據(jù)進行評估時提高其性能。因此,圖像增強對于提高訓(xùn)練數(shù)據(jù)的質(zhì)量和數(shù)量至關(guān)重要,最終導(dǎo)致更強大和更準確的 CNN 模型。

三、什么時候使用數(shù)據(jù)增強

圖像增強可以作為訓(xùn)練模型之前的預(yù)處理步驟,也可以在訓(xùn)練過程中實時應(yīng)用。當用作預(yù)處理步驟時,應(yīng)用增強來增加數(shù)據(jù)集的大小,特別是在處理需要擴展的小型訓(xùn)練數(shù)據(jù)集時。這種方法稱為離線或預(yù)處理增強,涉及生成現(xiàn)有圖像的變體以創(chuàng)建更多樣化的數(shù)據(jù)集。應(yīng)用圖像增強時仔細考慮問題領(lǐng)域非常重要,因為某些增強策略可能與特定任務(wù)無關(guān)或無用。例如,在對不同類型的汽車進行分類時,垂直翻轉(zhuǎn)汽車可能不會為數(shù)據(jù)集增加價值。因此,圖像增強的應(yīng)用應(yīng)根據(jù)問題領(lǐng)域的具體要求進行定制。


四、數(shù)據(jù)增強實戰(zhàn)

原始圖像及標簽:

運行數(shù)據(jù)增強代碼:


增強后的數(shù)據(jù)及標簽:

?關(guān)鍵代碼:

數(shù)據(jù)增強:

import cv2
import numpy as np
from PIL import Image, ImageDrawdef rand(a=0, b=1):return np.random.rand()*(b-a) + adef get_random_data(annotation_line, input_shape, jitter=.3, hue=.1, sat=0.7, val=0.4, random=True):line    = annotation_line.split()#------------------------------##   讀取圖像并轉(zhuǎn)換成RGB圖像#------------------------------#image   = Image.open(line[0])image   = image.convert('RGB')#------------------------------##   獲得圖像的高寬與目標高寬#------------------------------#iw, ih  = image.sizeh, w    = input_shape#------------------------------##   獲得預(yù)測框#------------------------------#box     = np.array([np.array(list(map(int,box.split(',')))) for box in line[1:]])if not random:scale = min(w/iw, h/ih)nw = int(iw*scale)nh = int(ih*scale)dx = (w-nw)//2dy = (h-nh)//2#---------------------------------##   將圖像多余的部分加上灰條#---------------------------------#image       = image.resize((nw,nh), Image.BICUBIC)new_image   = Image.new('RGB', (w,h), (128,128,128))new_image.paste(image, (dx, dy))image_data  = np.array(new_image, np.float32)#---------------------------------##   對真實框進行調(diào)整#---------------------------------#if len(box)>0:np.random.shuffle(box)box[:, [0,2]] = box[:, [0,2]]*nw/iw + dxbox[:, [1,3]] = box[:, [1,3]]*nh/ih + dybox[:, 0:2][box[:, 0:2]<0] = 0box[:, 2][box[:, 2]>w] = wbox[:, 3][box[:, 3]>h] = hbox_w = box[:, 2] - box[:, 0]box_h = box[:, 3] - box[:, 1]box = box[np.logical_and(box_w>1, box_h>1)] # discard invalid boxreturn image_data, box#------------------------------------------##   對圖像進行縮放并且進行長和寬的扭曲#------------------------------------------#new_ar = iw/ih * rand(1-jitter,1+jitter) / rand(1-jitter,1+jitter)scale = rand(.25, 2)if new_ar < 1:nh = int(scale*h)nw = int(nh*new_ar)else:nw = int(scale*w)nh = int(nw/new_ar)image = image.resize((nw,nh), Image.BICUBIC)#------------------------------------------##   將圖像多余的部分加上灰條#------------------------------------------#dx = int(rand(0, w-nw))dy = int(rand(0, h-nh))new_image = Image.new('RGB', (w,h), (128,128,128))new_image.paste(image, (dx, dy))image = new_image#------------------------------------------##   翻轉(zhuǎn)圖像#------------------------------------------#flip = rand()<.5if flip: image = image.transpose(Image.FLIP_LEFT_RIGHT)image_data      = np.array(image, np.uint8)#---------------------------------##   對圖像進行色域變換#   計算色域變換的參數(shù)#---------------------------------#r               = np.random.uniform(-1, 1, 3) * [hue, sat, val] + 1#---------------------------------##   將圖像轉(zhuǎn)到HSV上#---------------------------------#hue, sat, val   = cv2.split(cv2.cvtColor(image_data, cv2.COLOR_RGB2HSV))dtype           = image_data.dtype#---------------------------------##   應(yīng)用變換#---------------------------------#x       = np.arange(0, 256, dtype=r.dtype)lut_hue = ((x * r[0]) % 180).astype(dtype)lut_sat = np.clip(x * r[1], 0, 255).astype(dtype)lut_val = np.clip(x * r[2], 0, 255).astype(dtype)image_data = cv2.merge((cv2.LUT(hue, lut_hue), cv2.LUT(sat, lut_sat), cv2.LUT(val, lut_val)))image_data = cv2.cvtColor(image_data, cv2.COLOR_HSV2RGB)#---------------------------------##   對真實框進行調(diào)整#---------------------------------#if len(box)>0:np.random.shuffle(box)box[:, [0,2]] = box[:, [0,2]]*nw/iw + dxbox[:, [1,3]] = box[:, [1,3]]*nh/ih + dyif flip: box[:, [0,2]] = w - box[:, [2,0]]box[:, 0:2][box[:, 0:2]<0] = 0box[:, 2][box[:, 2]>w] = wbox[:, 3][box[:, 3]>h] = hbox_w = box[:, 2] - box[:, 0]box_h = box[:, 3] - box[:, 1]box = box[np.logical_and(box_w>1, box_h>1)] return image_data, box

調(diào)用代碼:

import os
from random import sampleimport numpy as np
from PIL import Image, ImageDrawfrom utils.random_data import get_random_data, get_random_data_with_MixUp
from utils.utils import convert_annotation, get_classes#-----------------------------------------------------------------------------------#
#   Origin_VOCdevkit_path   原始數(shù)據(jù)集所在的路徑
#-----------------------------------------------------------------------------------#
Origin_VOCdevkit_path   = "VOCdevkit_Origin"
#-----------------------------------------------------------------------------------#
#   input_shape             生成的圖片大小。
#-----------------------------------------------------------------------------------#
input_shape             = [640, 640]if __name__ == "__main__":Origin_JPEGImages_path  = os.path.join(Origin_VOCdevkit_path, "VOC2007/JPEGImages")Origin_Annotations_path = os.path.join(Origin_VOCdevkit_path, "VOC2007/Annotations")#---------------------------##   遍歷標簽并賦值#---------------------------#xml_names = os.listdir(Origin_Annotations_path)#------------------------------##   獲取一個圖像與標簽#------------------------------#sample_xmls     = sample(xml_names, 1)unique_labels   = get_classes(sample_xmls, Origin_Annotations_path)jpg_name        = os.path.join(Origin_JPEGImages_path, os.path.splitext(sample_xmls[0])[0] + '.jpg')xml_name        = os.path.join(Origin_Annotations_path, sample_xmls[0])line = convert_annotation(jpg_name, xml_name, unique_labels)#------------------------------##   各自數(shù)據(jù)增強#------------------------------#image_data, box_data  = get_random_data(line, input_shape) img = Image.fromarray(image_data.astype(np.uint8))for j in range(len(box_data)):thickness = 3left, top, right, bottom  = box_data[j][0:4]draw = ImageDraw.Draw(img)for i in range(thickness):draw.rectangle([left + i, top + i, right - i, bottom - i],outline=(255, 255, 255))img.show()

http://m.aloenet.com.cn/news/33750.html

相關(guān)文章:

  • 有哪些網(wǎng)站可以做視頻百度一下免費下載安裝
  • 類似百科式的網(wǎng)站建設(shè)app推廣平臺
  • asp網(wǎng)站助手北京網(wǎng)站優(yōu)化步
  • 免費制圖網(wǎng)站關(guān)鍵詞seo公司推薦
  • 中國做的電腦系統(tǒng)下載網(wǎng)站免費大數(shù)據(jù)網(wǎng)站
  • wordpress怎么修改文字白楊seo教程
  • 甘肅省城鄉(xiāng)與住房建設(shè)廳網(wǎng)站怎么網(wǎng)站推廣
  • 徐州網(wǎng)站建設(shè)方案推廣網(wǎng)址查詢注冊信息查詢
  • 用新域名做網(wǎng)站排名快嗎上海外貿(mào)seo
  • 怎么模仿別人做網(wǎng)站臺州專業(yè)關(guān)鍵詞優(yōu)化
  • 公司官網(wǎng)網(wǎng)站如何建立朋友圈的廣告推廣怎么弄
  • 做網(wǎng)站用js的好處seo的中文含義是
  • 丹陽網(wǎng)站建設(shè)服務(wù)網(wǎng)絡(luò)銷售是什么
  • 網(wǎng)站的做網(wǎng)站公司哪家好鄭州百度推廣代運營
  • 星空影視文化傳媒制作公司網(wǎng)站seo綜合診斷
  • 日本男女做受網(wǎng)站公司專業(yè)網(wǎng)站建設(shè)
  • 上海網(wǎng)頁設(shè)計班咸寧網(wǎng)站seo
  • 廣州網(wǎng)站建設(shè)怎么做福清市百度seo
  • 網(wǎng)站備案阿里云流程seo網(wǎng)站推廣杭州
  • 做曖暖的免費網(wǎng)站windows優(yōu)化軟件排行
  • 免費最好網(wǎng)站建設(shè)百度明星搜索量排行榜
  • 網(wǎng)絡(luò)技術(shù)網(wǎng)站seo在線培訓(xùn)課程
  • 營銷型網(wǎng)站的推廣社區(qū)推廣
  • 做柜子網(wǎng)站營銷型企業(yè)網(wǎng)站推廣的方法有哪些
  • 域名經(jīng)紀公司推薦關(guān)鍵詞優(yōu)化建議
  • 政府部門網(wǎng)站方案公司建網(wǎng)站需要多少錢
  • 查詢網(wǎng)站備案時間查詢seo建站要求
  • 廣州做網(wǎng)站建設(shè)哪家專業(yè)分銷系統(tǒng)
  • 做jsp動態(tài)網(wǎng)站需要的步驟鴻科經(jīng)緯教網(wǎng)店運營推廣
  • 免費注冊163成都seo招聘信息