当前位置: 首页 > news >正文

Halcon 频域缺陷检测

文章目录

  • 傅里叶变换频谱
    • 矩形
    • 菱形
    • 黑白相间的亮带
    • 去除图纹(反傅里叶变换)
    • 去除图纹滤波器处理
  • Halcon 频域+空间域检测缺陷
  • Halcon 频域+差分+空间域 缺陷检测(lines_gauss 提取线)
  • Halcon 频域+差分+空间域(blob+特征)案例
  • Halcon Blob+特征处理缺陷
  • Halcon 频域+空间域检测划痕
  • Halcon 傅里叶变换转换为功率图(频域+blob+差分)
  • Halcon 训练学习缺陷检测(以神经网络mlp为例)

傅里叶变换频谱

傅里叶去除纹理

矩形

read_image (Image1, 'C:/Users/Augustine/Desktop/频谱图形/1.png')
fft_image(Image1,ImageFFT)

在这里插入图片描述

read_image (Image2, 'C:/Users/Augustine/Desktop/频谱图形/2.png')
fft_generic(Image2, ImageFFT, 'to_freq', -1, 'sqrt', 'dc_center', 'complex')

在这里插入图片描述

菱形

read_image (Image3, 'C:/Users/Augustine/Desktop/频谱图形/3.png')
fft_image(Image3, ImageFFT)

在这里插入图片描述

黑白相间的亮带

read_image (Image4, 'C:/Users/Augustine/Desktop/频谱图形/4.png')
fft_generic(Image4, ImageFFT, 'to_freq', -1, 'sqrt', 'dc_center', 'complex')

在这里插入图片描述

去除图纹(反傅里叶变换)

read_image (Image4, 'C:/Users/Augustine/Desktop/频谱图形/4.png')
* 图片转换为灰度图
rgb1_to_gray(Image4, GrayImage)
fft_image(GrayImage, ImageFFT)
gen_rectangle1 (ROI_0, 12.9631, 372.108, 377.501, 710.691)
gen_rectangle1 (ROI_0, 17.1055, 11.9479, 373.359, 347.212)
union2(ROI_0, ROI_0, RegionUnion)
gen_rectangle1 (ROI_0, 412.712, 13.6076, 754.467, 345.552)
union2(ROI_0, ROI_0, RegionUnion1)
gen_rectangle1 (ROI_0, 412.712, 368.788, 768.966, 709.031)
union2(ROI_0, ROI_0, RegionUnion2)
* 区域填充
paint_region(RegionUnion2, ImageFFT, ImageResult,0, 'fill')
* 反傅里叶变换
fft_image_inv(ImageResult, ImageFFTInv)

在这里插入图片描述在这里插入图片描述

去除图纹滤波器处理

低通滤波器、高通滤波器和中通滤波器都是数字图像处理中常用的滤波器,它们的作用是将输入图像信号进行滤波处理,以达到去除噪声、增强图像特征等目的。低通滤波器(Low-Pass Filter):低通滤波器可以去除图像中高频部分的信息,保留低频部分的信息。在频域上看,低通滤波器会将图像高频成分的能量减弱,从而产生模糊的效果。低通滤波器一般用于平滑图像、去除噪声等应用场景。高通滤波器(High-Pass Filter):高通滤波器可以去除图像中低频部分的信息,保留高频部分的信息。在频域上看,高通滤波器会将图像低频成分的能量减弱,从而使高频细节更加突出。高通滤波器一般用于图像增强、边缘检测等应用场景。中通滤波器(Band-Pass Filter):中通滤波器可以去除图像中低频和高频部分的信息,保留中频部分的信息。中通滤波器一般用于分离出图像中特定频率范围内的信息,例如检测特定大小的物体。
read_image (Image4, 'C:/Users/Augustine/Desktop/频谱图形/4.png')
* 图片转换为灰度图
rgb1_to_gray(Image4, GrayImage)
*fft_image(GrayImage, ImageFFT)
fft_generic(ImageConvol, ImageFFT1, 'to_freq', -1, 'sqrt', 'dc_center', 'complex'))
get_image_size(ImageFFT, Width, Height)
* 高通滤波器,低频段挡住为黑色
gen_highpass(ImageHighpass, 0.2, 'none', 'dc_center', Width, Height)
* 频域中对两个经过傅里叶变换的图像进行卷积操作
convol_fft(ImageFFT, ImageHighpass, ImageConvol)
* 反傅里叶变换  第三 参数改成'from_freq',1-1要反着来
fft_generic(ImageConvol, ImageFFT1, 'from_freq', 1, 'sqrt', 'dc_center', 'complex'))

在这里插入图片描述

Halcon 频域+空间域检测缺陷

高斯滤波主要用于祛除图像中的高频成分(低通滤波器),也就是去除图像中的细节和噪声。通过在图像上应用高斯核进行卷积操作,高频部分会被削弱,从而使图像变得更加平滑。

由于高斯核的特性,其在中心位置具有最大值,并且随着离中心的距离逐渐减小。这意味着高斯滤波会更强调图像中的低频信息,即图像中相对较平均和较大尺度的变化。而高频信息,例如细节和噪声,由于高斯核的衰减作用,会在滤波过程中被抑制或消除。

因此,高斯滤波的主要效果是减少图像中的高频成分,实现图像的平滑和模糊化。这种平滑可以有效地去除图像中的噪声,并在某些情况下有助于提高图像处理的结果。

在这里插入图片描述

* This program demonstrates how to detect small texture
* defects on the surface of plastic items by using the fast
* fourier transform (FFT).
* First, we construct a suitable filter using Gaussian
* filters. Then, the images and the filter are convolved
* by using fast fourier transforms. Finally, the defects
* are detected in the filtered images by using
* morphology operators.
* 
* Initializations
* 1.采集图像
dev_update_off ()
dev_close_window ()
read_image (Image, 'plastics/plastics_01')
get_image_size (Image, Width, Height)
dev_open_window (0, 0, Width, Height, 'black', WindowHandle)
set_display_font (WindowHandle, 14, 'mono', 'true', 'false')
dev_set_draw ('margin')
dev_set_line_width (3)
dev_set_color ('red')
* 针对图像大小进行优化
* Optimize the fft speed for the specific image size
optimize_rft_speed (Width, Height, 'standard')
* 
* Construct a suitable filter by combining two gaussian
* filters
* 产生两个滤波器
Sigma1 := 10.0
Sigma2 := 3.0
* 2.产生滤波器(产生高斯滤波)
gen_gauss_filter (GaussFilter1, Sigma1, Sigma1, 0.0, 'none', 'rft', Width, Height)
gen_gauss_filter (GaussFilter2, Sigma2, Sigma2, 0.0, 'none', 'rft', Width, Height)
* 滤波器进行差分,形成一个新的滤波器
sub_image (GaussFilter1, GaussFilter2, Filter, 1, 0)
* 
* Process the images iteratively
NumImages := 11
for Index := 1 to NumImages by 1* * Read an image and convert it to gray valuesread_image (Image, 'plastics/plastics_' + Index$'02')rgb1_to_gray (Image, Image)* 3.傅里叶变换(频域变换)* Perform the convolution in the frequency domain* 空间域转换为频域rft_generic (Image, ImageFFT, 'to_freq', 'none', 'complex', Width)* 频域中对两个经过傅里叶变换的图像进行卷积操作convol_fft (ImageFFT, Filter, ImageConvol)* 将频域转换为空间域rft_generic (ImageConvol, ImageFiltered, 'from_freq', 'n', 'real', Width)* * Process the filtered image* 4.空间域blob 分析* 灰度范围变化(把图像亮的地方更亮,暗的地方更暗)gray_range_rect (ImageFiltered, ImageResult, 10, 10)min_max_gray (ImageResult, ImageResult, 0, Min, Max, Range)threshold (ImageResult, RegionDynThresh, max([5.55,Max * 0.8]), 255)connection (RegionDynThresh, ConnectedRegions)select_shape (ConnectedRegions, SelectedRegions, 'area', 'and', 4, 99999)union1 (SelectedRegions, RegionUnion)closing_circle (RegionUnion, RegionClosing, 10)connection (RegionClosing, ConnectedRegions1)select_shape (ConnectedRegions1, SelectedRegions1, 'area', 'and', 10, 99999)* 获取缺陷点的坐标area_center (SelectedRegions1, Area, Row, Column)* * Display the results* 找缺陷dev_display (Image)Number := |Area|if (Number)gen_circle_contour_xld (ContCircle, Row, Column, gen_tuple_const(Number,30), gen_tuple_const(Number,0), gen_tuple_const(Number,rad(360)), 'positive', 1)ResultMessage := ['Not OK',Number + ' defect(s) found']Color := ['red','black']dev_display (ContCircle)elseResultMessage := 'OK'Color := 'forest green'endifdisp_message (WindowHandle, ResultMessage, 'window', 12, 12, Color, 'true')if (Index != NumImages)disp_continue_message (WindowHandle, 'black', 'true')stop ()endif
endfor

在这里插入图片描述

Halcon 频域+差分+空间域 缺陷检测(lines_gauss 提取线)

在这里插入图片描述

* this example shows how to detect mura defects
* in blurred images
* 
dev_close_window ()
dev_update_off ()
Path := 'lcd/mura_defects_blur_'
read_image (Image, Path + '01')
get_image_size (Image, Width, Height)
dev_open_window_fit_size (0, 0, Width, Height, 640, 480, WindowHandle)
set_display_font (WindowHandle, 14, 'mono', 'true', 'false')
dev_set_draw ('margin')
dev_set_line_width (3)
dev_set_color ('red')
* 设置缩放因子
ScaleFactor := 0.4
* 计算高斯线性参数
calculate_lines_gauss_parameters (17, [25,3], Sigma, Low, High)
for f := 1 to 3 by 1read_image (Image, Path + f$'.2i')* 获取rgb 通道decompose3 (Image, R, G, B)* correct side illumination* 频域处理fft_generic(B, ImageFFT, 'to_freq', -1, 'none', 'dc_center', 'complex')*rft_generic (B, ImageFFT, 'to_freq', 'none', 'complex', Width)* 产生高斯过滤*gen_gauss_filter (ImageGauss, 100, 100, 0, 'n', 'rft', Width, Height)gen_gauss_filter(ImageGauss, 100, 100, 0, 'n', 'dc_center', Width, Height)* 频域中对两个经过傅里叶变换的图像进行卷积操作convol_fft (ImageFFT, ImageGauss, ImageConvol)*从频域转换为空间域fft_generic(ImageConvol, ImageFFT1, 'from_freq', -1, 'none', 'dc_center', 'byte')*rft_generic (ImageConvol, ImageFFT1, 'from_freq', 'none', 'byte', Width)* 图片相减 mageSub=(B-ImageFFT1)*2+100sub_image (B, ImageFFT1, ImageSub, 2, 100)* perform the actual inspection* 按照比例因子缩放zoom_image_factor (ImageSub, ImageZoomed, ScaleFactor, ScaleFactor, 'constant')* avoid border effects when using lines_gauss()* 由图像转换为区域,获取区域get_domain (ImageZoomed, Domain)* 腐蚀运算erosion_rectangle1 (Domain, RegionErosion, 7, 7)* 裁剪区域reduce_domain (ImageZoomed, RegionErosion, ImageReduced)* 空间域检测线条lines_gauss (ImageReduced, Lines, Sigma, Low, High, 'dark', 'true', 'gaussian', 'true')* 仿射变换hom_mat2d_identity (HomMat2DIdentity)hom_mat2d_scale_local (HomMat2DIdentity, 1 / ScaleFactor, 1 / ScaleFactor, HomMat2DScale)affine_trans_contour_xld (Lines, Defects, HomMat2DScale)* 显示dev_display (Image)dev_display (Defects)if (f < 3)disp_continue_message (WindowHandle, 'black', 'true')stop ()endif
endfor

在这里插入图片描述

Halcon 频域+差分+空间域(blob+特征)案例

在这里插入图片描述

estimate_background_illumination (B, ImageFFT1)

get_image_size (Image, Width, Height)
* 空间域转换为频域
fft_generic(Image, ImageFFT, 'to_freq', -1, 'none', 'dc_center', 'complex')
*rft_generic (Image, ImageFFT, 'to_freq', 'none', 'complex', Width)
* 产生高斯滤波
*gen_gauss_filter (ImageGauss, 50, 50, 0, 'n', 'rft', Width, Height)
gen_gauss_filter(ImageGauss, 50, 50, 0, 'n', 'dc_center', Width, Height)
* 卷积
convol_fft (ImageFFT, ImageGauss, ImageConvol)
* 频域转换为空间域
fft_generic(ImageConvol, IlluminationImage, 'from_freq', 1, 'sqrt', 'dc_center', 'byte')
*rft_generic (ImageConvol, IlluminationImage, 'from_freq', 'none', 'byte', Width)
return ()
* This example shows how to detect mura defects
* in highly textured images
* 
* 图片预处理
dev_close_window ()
dev_update_off ()
Path := 'lcd/mura_defects_texture_'
read_image (Image, Path + '01')
get_image_size (Image, Width, Height)
dev_open_window (0, 0, 640, 480, 'black', WindowHandle)
set_display_font (WindowHandle, 14, 'mono', 'true', 'false')
dev_set_draw ('margin')
dev_set_line_width (3)
dev_set_color ('red')
for F := 1 to 2 by 1*1.采集图像read_image (Image, Path + F$'.2i')decompose3 (Image, R, G, B)* Defects are characterized by dark patches. Hence, by substracting the* estimated background illumination from the original image the* defects become more apparent.* 2.频域处理+差分estimate_background_illumination (B, ImageFFT1)* sub_image (B, ImageFFT1, ImageSub, 2, 100)* 3.空间域blob+特征* Median filter smoothes out the fine texture, simplifying the following* segmentation and final detection of defects.* 中值滤波median_image (ImageSub, ImageMedian, 'circle', 9, 'mirrored')watersheds_threshold (ImageMedian, Basins, 20)* Dark patches corresponding to defects have a very low energy.cooc_feature_image (Basins, ImageMedian, 6, 0, Energy, Correlation, Homogeneity, Contrast)*tuple_find(sgn(Energy-0.05),-1,Indices)*select_obj(Basins, Defects, Indices+1)* 如果Energy<= 0.05Mask := Energy [<=] 0.05* 获取Mask 个数select_mask_obj (Basins, Defects, Mask)* 显示dev_display (Image)dev_display (Defects)count_obj (Defects, NDefects)disp_message (WindowHandle, NDefects + ' \'mura\' defects detected', 'window', 12, 12, 'red', 'true')if (F < 2)disp_continue_message (WindowHandle, 'black', 'true')stop ()endif
endfor

在这里插入图片描述

Halcon Blob+特征处理缺陷

在这里插入图片描述

* This programm shows the extraction of surface scratches via
* local thresholding and morphological post-processing
* 
dev_update_off ()
dev_close_window ()
* 
* Step 1: Acquire image
* 1.采集图片
read_image (Image, 'surface_scratch')
get_image_size (Image, Width, Height)
dev_open_window_fit_image (Image, 0, 0, Width, Width, WindowID)
set_display_font (WindowID, 16, 'mono', 'true', 'false')
dev_set_draw ('margin')
dev_set_line_width (4)
dev_display (Image)
Message := 'This program shows the extraction of'
Message[1] := 'surface scratches via local thresholding'
Message[2] := 'and morphological post-processing'
disp_message (WindowID, Message, 'window', 12, 12, 'black', 'true')
disp_continue_message (WindowID, 'black', 'true')
stop ()
* 
* Step 2: Segment image
* 2.图像分割
* Using a local threshold
* 均值滤波
mean_image (Image, ImageMean, 7, 7)
* 动态二值化
dyn_threshold (Image, ImageMean, DarkPixels, 5, 'dark')
* 
* Extract connected components
* 形成单独的连通域
connection (DarkPixels, ConnectedRegions)
dev_set_colored (12)
dev_display (Image)
dev_display (ConnectedRegions)
Message := 'Connected components after image segmentation'
Message[1] := 'using a local threshold.'
disp_message (WindowID, Message, 'window', 12, 12, 'black', 'true')
disp_continue_message (WindowID, 'black', 'true')
stop ()
* 
* Step 3: Process regions
* 
* Select large regions
* 筛选面积大小
select_shape (ConnectedRegions, SelectedRegions, 'area', 'and', 10, 1000)
dev_display (Image)
dev_display (SelectedRegions)
disp_message (WindowID, 'Large Regions', 'window', 12, 12, 'black', 'true')
disp_continue_message (WindowID, 'black', 'true')
stop ()
* 
* Visualize fractioned scratch
* 在新的窗口打开
open_zoom_window (0, round(Width / 2), 2, 303, 137, 496, 3, WindowHandleZoom)
dev_set_color ('blue')
dev_display (Image)
dev_display (SelectedRegions)
set_display_font (WindowHandleZoom, 16, 'mono', 'true', 'false')
disp_message (WindowHandleZoom, 'Fractioned scratches', 'window', 12, 12, 'black', 'true')
disp_continue_message (WindowHandleZoom, 'black', 'true')
stop ()
* 
* Merge fractioned scratches via morphology
* 联合
union1 (SelectedRegions, RegionUnion)
* 膨胀
dilation_circle (RegionUnion, RegionDilation, 3.5)
dev_display (Image)
dev_display (RegionDilation)
Message := 'Region of the scratches after dilation'
disp_message (WindowHandleZoom, Message, 'window', 12, 12, 'black', 'true')
disp_continue_message (WindowHandleZoom, 'black', 'true')
stop ()
*提取骨架
skeleton (RegionDilation, Skeleton)
* 形成单独的连通域
connection (Skeleton, Errors)
dev_set_colored (12)
dev_display (Image)
dev_display (Errors)
Message := 'Fractioned scratches merged via morphology'
disp_message (WindowHandleZoom, Message, 'window', 12, 12, 'black', 'true')
disp_continue_message (WindowHandleZoom, 'black', 'true')
stop ()
* 
* Distinguish small and large scratches
close_zoom_window (WindowHandleZoom, Width, Height)
* 筛选出区域面积(大划痕)
select_shape (Errors, Scratches, 'area', 'and', 50, 10000)
select_shape (Errors, Dots, 'area', 'and', 1, 50)
* 小划痕
dev_display (Image)
dev_set_color ('red')
dev_display (Scratches)
dev_set_color ('blue')
dev_display (Dots)
Message := 'Extracted surface scratches'
Message[1] := 'Not categorized as scratches'
disp_message (WindowID, Message, 'window', 440, 310, ['red','blue'], 'true')

在这里插入图片描述

Halcon 频域+空间域检测划痕

在这里插入图片描述

* This program shows how to detect defects (scratches) in
* an inhomogeneously illuminated surface by filtering in
* the frequency domain.
* First, a suitable bandpass filter is created. Then, the
* input image is fourier transformed and filtered in the
* frequency domain, so that high frequency information is
* enhanced. Finally, it is transformed back to the
* spatial domain and the enhanced defects are post-processed
* by morphology.
* 1.采集图像
dev_update_off ()
dev_close_window ()
read_image (Image, 'surface_scratch')
* 图像翻转(暗点变成亮点,亮点变成暗点)
invert_image (Image, ImageInverted)
get_image_size (Image, Width, Height)
dev_open_window (0, 0, Width, Height, 'black', WindowHandle)
set_display_font (WindowHandle, 16, 'mono', 'true', 'false')
dev_display (Image)
* 
* Optimize the speed of the fast fourier transform
* Message := 'Optimize the speed of the fast fourier transform.'
* Message[1] := 'Please wait...'
* disp_message (WindowHandle, Message, 'window', 12, 12, 'black', 'true')
* optimize_rft_speed (Width, Height, 'standard')
* disp_continue_message (WindowHandle, 'black', 'true')
* stop ()
* 2.频域变换
* Enhance the scratches by filtering in the frequency domain
* 形成一个正弦滤波器 (可以移到中间)
*gen_sin_bandpass (ImageBandpass, 0.4, 'none', 'rft', Width, Height)
gen_sin_bandpass(ImageBandpass, 0.4, 'none', 'dc_center', Width, Height)
*rft_generic (ImageInverted, ImageFFT, 'to_freq', 'none', 'complex', Width)
fft_generic(ImageInverted, ImageFFT, 'to_freq', -1, 'none', 'dc_center', 'complex')
* 卷积
convol_fft (ImageFFT, ImageBandpass, ImageConvol)
fft_generic(ImageConvol, Lines, 'from_freq', 1, 'n', 'dc_center', 'byte')
*rft_generic (ImageConvol, Lines, 'from_freq', 'n', 'byte', Width)
* 
* Segment the scratches by using morphology
* blob 分析
threshold (Lines, Region, 5, 255)
connection (Region, ConnectedRegions)
select_shape (ConnectedRegions, SelectedRegions, 'area', 'and', 5, 5000)
dilation_circle (SelectedRegions, RegionDilation, 5.5)
union1 (RegionDilation, RegionUnion)
reduce_domain (Image, RegionUnion, ImageReduced)
* 获取线
lines_gauss (ImageReduced, LinesXLD, 0.8, 3, 5, 'dark', 'false', 'bar-shaped', 'false')
* 共线联合
union_collinear_contours_xld (LinesXLD, UnionContours, 40, 3, 3, 0.2, 'attr_keep')
select_shape_xld (UnionContours, SelectedXLD, 'contlength', 'and', 15, 1000)
* xld 转区域
gen_region_contour_xld (SelectedXLD, RegionXLD, 'filled')
union1 (RegionXLD, RegionUnion)
dilation_circle (RegionUnion, RegionScratches, 10.5)
* 
* Display the results
dev_set_draw ('margin')
dev_set_line_width (3)
dev_set_colored (12)
dev_display (Image)
dev_display (RegionScratches)

在这里插入图片描述
在这里插入图片描述

Halcon 傅里叶变换转换为功率图(频域+blob+差分)

在这里插入图片描述

* This program shows how to separate foreground information
* from a disturbing background texture by filtering in the
* frequency domain.
* First, the image is fourier transformed in order to obtain
* its frequency spectrum. Then, we detect the frequency peaks
* corresponding to the disturbing background texture in the
* frequency spectrum. Afterwards, a filter which eliminates those
* frequencies is built and applied to the spectrum. By applying
* the inverse fourier transform to the filtered spectrum, we
* obtain a filtered image from which the disturbing background
* texture was removed.
* 
dev_update_off ()
dev_close_window ()
Scale := [1.0,.65]
MinGray := [50,100]
for Index := 0 to 1 by 1* * Read and display the imageread_image (Image, 'plan_' + (Index + 1)$'02')get_image_size (Image, Width, Height)dev_open_window (0, 0, Width * Scale[Index], Height * Scale[Index], 'black', WindowHandle)set_display_font (WindowHandle, 14, 'mono', 'true', 'false')dev_set_part (0, 0, Height - 1, Width - 1)dev_display (Image)disp_message (WindowHandle, 'Original image', 'window', 12, 12, 'black', 'true')* * Perform fft and display spectrum  * 优化速度optimize_fft_speed (Width, Height, 'standard')* * We used 'fft_generic' 'sqrt' and 'dc_center' mainly* for visualization purposes.* To speed up the program, rft_generic should be used;* but of course, the peak detection algorithm has to be* adjusted in this case.fft_generic (Image, ImageFFT, 'to_freq', -1, 'sqrt', 'dc_center', 'complex')dev_open_window (0, Width * Scale[Index] + 7, Width * Scale[Index], Height * Scale[Index], 'black', WindowHandle1)dev_set_color ('red')dev_set_draw ('margin')set_display_font (WindowHandle1, 14, 'mono', 'true', 'false')dev_set_part (0, 0, Height - 1, Width - 1)dev_display (ImageFFT)disp_message (WindowHandle1, 'Fourier spectrum', 'window', 12, 12, 'black', 'true')disp_cont_message (WindowHandle1, 'black', 'true')stop ()* * Detect the eight most significant peaks in the spectrum* 转换为功率图power_real (ImageFFT, PowerSpectrum)* 低通滤波binomial_filter (PowerSpectrum, ImageSmooth, 9, 9)* 二值化threshold (ImageSmooth, Region, MinGray[Index], 100000)* 形成单个连通域connection (Region, ConnectedRegions)select_shape (ConnectedRegions, SelectedRegions, 'area', 'and', 5, 200)union1 (SelectedRegions, RegionUnion)reduce_domain (ImageSmooth, RegionUnion, ImageReduced)* 获取局部最大值local_max (ImageReduced, LocalMaxima)* * Next, detect peaks one octave higher, i.e., at twice* the frequency of the most significant peaks* 形成一个包凸shape_trans (LocalMaxima, RegionTrans, 'convex')* Construct ROI band at twice the frequency* 形成一个缩放矩阵的仿射变换hom_mat2d_identity (HomMat2DIdentity)hom_mat2d_scale (HomMat2DIdentity, 2.1, 2.1, Height / 2, Width / 2, HomMat2DScale)affine_trans_region (RegionTrans, RegionTrans1, HomMat2DScale, 'nearest_neighbor')hom_mat2d_scale (HomMat2DIdentity, 1.9, 1.9, Height / 2, Width / 2, HomMat2DScale)affine_trans_region (RegionTrans, RegionTrans2, HomMat2DScale, 'nearest_neighbor')* 进行差分difference (RegionTrans1, RegionTrans2, RegionDifference)* Extract the peaks at twice the frequency* 差分区域进行裁剪reduce_domain (ImageSmooth, RegionDifference, ImageReduced)threshold (ImageReduced, Region, 15, 100000)reduce_domain (ImageSmooth, Region, ImageReduced)* 获取局部最大值local_max (ImageReduced, LocalMaxima2)* * Merge the peaks of both octaves and enlarge them to* integrate the relevant frequencies into the filter* 将之前的到的区域和后面的区域进行联合union2 (LocalMaxima, LocalMaxima2, RegionUnion)* 膨胀处理dilation_circle (RegionUnion, RegionDilation, 15.5)* 将获取的区域得到填充paint_region (RegionDilation, ImageFFT, ImageFFTFiltered, 0, 'fill')dev_display (ImageFFT)dev_display (RegionDilation)disp_message (WindowHandle1, 'Frequencies of the\nbackground texture', 'window', 12, 12, 'black', 'true')disp_cont_message (WindowHandle1, 'black', 'true')stop ()* * Apply the filter and display the results* 反傅里叶变换fft_generic (ImageFFTFiltered, ImageFiltered, 'from_freq', 1, 'sqrt', 'dc_center', 'byte')dev_display (ImageFiltered)disp_message (WindowHandle1, 'Filtered image', 'window', 12, 12, 'black', 'true')* dev_open_window (0, 2 * (Width * Scale[Index]) + 14, Width * Scale[Index], Height * Scale[Index], 'black', WindowHandle2)set_display_font (WindowHandle2, 14, 'mono', 'true', 'false')dev_set_part (0, 0, Height - 1, Width - 1)sub_image (Image, ImageFiltered, ImageTexture, 1, 128)dev_display (ImageTexture)disp_message (WindowHandle2, 'Removed texture', 'window', 12, 12, 'black', 'true')if (Index < 1)disp_cont_message (WindowHandle2, 'black', 'true')stop ()dev_close_window ()dev_close_window ()dev_close_window ()endif
endfor

在这里插入图片描述

Halcon 训练学习缺陷检测(以神经网络mlp为例)

在这里插入图片描述

create_class_mlp 创建
add_samples_image_class_mlp添加样本
set_rejection_params_class_mlp 设置拒绝参数
train_class_mlp 训练
write_class_mlp 保存
classify_image_class_mlp 识别

* This example program shows how to use the MLP classifier for novelty
* detection to perform a web inspection task.  To perform the novelty detection,
* a rejection class is trained internally.
* For the web inspection task, the MLP can subsequently be used to detect
* textures that do not correspond to the texture of the trained good objects.
* 1.采集图像
dev_update_off ()
* 
ReadPretrainedClassifier := false
* Uncomment the following line to read the pretrained classifier from
* disk. The training may last up to half a minute.
* ReadPretrainedClassifier := true
SaveClassifier := false
* Uncomment the following line to write the MLP classifier to disk after training.
* SaveClassifier := true
* 
read_image (Image, 'plastic_mesh/plastic_mesh_01')
get_image_size (Image, Width, Height)
dev_close_window ()
dev_open_window (0, 0, Width, Height, 'black', WindowHandle)
dev_set_color ('red')
set_display_font (WindowHandle, 16, 'mono', 'true', 'false')
* 获取系统信息
get_system ('example_dir', HalconExamples)
* The texture filters used for the classification will return artifacts at the image
* borders because the images of the plastic mesh to be inspected do not
* contain an integer number of mesh cells.  Because this would lead to wrongly
* detected errors at the image borders, we must exclude the area close to the
* image border from the training and classification.  This is done with the following
* rectangle.  Note that the image is later scaled down by a factor of two.
* 产生矩形窗口
gen_rectangle1 (Rectangle, 10, 10, Height / 2 - 11, Width / 2 - 11)
* 如果没有分类器则创建分类器
if (ReadPretrainedClassifier)* Read the pretrained classifier from disk.dev_display (Image)disp_message (WindowHandle, 'Reading classifier from disk...', 'window', 10, 10, 'black', 'true')read_class_mlp (HalconExamples + '/hdevelop/Segmentation/Classification/novelty_detection.gmc', MLPHandle)wait_seconds (1.5)
else* Create the MLP classifier.* 创建分类器* 第一个参数为特征变量的数量(和通道数对应->  gen_texture_image (ImageZoomed, ImageTexture)create_class_mlp (5, 9, 2, 'softmax', 'principal_components', 3, 42, MLPHandle)* The training is based on five images that contain no errors.* 形成一个空的区域gen_empty_region (EmptyRegion)* 将Rectangle和EmptyRegion 放入到 ObjectsConcat 中concat_obj (Rectangle, EmptyRegion, ObjectsConcat)for J := 1 to 5 by 1read_image (Image, 'plastic_mesh/plastic_mesh_' + J$'02')* The images are zoomed down because the resolution of the mesh is very* high.  This saves a large amount of processing time.* 等比例缩放图片zoom_image_factor (Image, ImageZoomed, 0.5, 0.5, 'constant')dev_display (ImageZoomed)disp_message (WindowHandle, 'Adding training samples...', 'window', 10, 10, 'black', 'true')* Generate the texture image.* 形成一个纹理图像gen_texture_image (ImageZoomed, ImageTexture)* Add the samples to the classifier.* 添加样本add_samples_image_class_mlp (ImageTexture, ObjectsConcat, MLPHandle)endfordev_display (ImageZoomed)* Now configure the MLP that a rejection class will be added during training.* 设置不符合要求的参数(必须要设置)set_rejection_params_class_mlp (MLPHandle, 'sampling_strategy', 'hyperbox_ring_around_each_class')set_rejection_params_class_mlp (MLPHandle, 'rejection_sample_factor', .3)* Train the MLP.disp_message (WindowHandle, 'Training MLP...', 'window', 10, 10, 'black', 'true')* 训练train_class_mlp (MLPHandle, 200, 1, 0.01, Error, ErrorLog)if (SaveClassifier)*保存分类器write_class_mlp (MLPHandle, HalconExamples + '/hdevelop/Segmentation/Classification/novelty_detection.gmc')endif
endif
* Now detect errors in the plastic meshes.
dev_set_draw ('margin')
dev_set_line_width (3)
for J := 1 to 14 by 1read_image (Image, 'plastic_mesh/plastic_mesh_' + J$'02')zoom_image_factor (Image, ImageZoomed, 0.5, 0.5, 'constant')dev_display (ImageZoomed)dev_set_color ('white')dev_display (Rectangle)gen_texture_image (ImageZoomed, ImageTexture)reduce_domain (ImageTexture, Rectangle, ImageTextureReduced)* Classify samples belonging to the trained class with the MLP.* 识别classify_image_class_mlp (ImageTextureReduced, ClassRegions, MLPHandle, 0.5)* Post process the returned raw errors to remove insignificant parts of the* detected errors.select_obj (ClassRegions, Correct, 1)select_obj (ClassRegions, Errors, 2)opening_circle (Errors, ErrorsOpening, 2.5)closing_circle (ErrorsOpening, ErrorsClosing, 12.5)connection (ErrorsClosing, ErrorsConnected)* 筛选出缺陷select_shape (ErrorsConnected, FinalErrors, 'area', 'and', 20, 1000000)* 缺陷放入容器count_obj (FinalErrors, NumErrors)dev_set_color ('red')dev_display (FinalErrors)if (NumErrors > 0)disp_message (WindowHandle, 'Mesh not OK', 'window', 10, 10, 'red', 'true')elsedisp_message (WindowHandle, 'Mesh OK', 'window', 10, 10, 'forest green', 'true')endifif (J < 14)disp_continue_message (WindowHandle, 'black', 'true')endifstop ()
endfor

产生滤波算子

gen_texture_image 
* The texture image is a five-channel image that contains the result of applying
* five different Laws filters, which basically correspond to first and second
* derivatives, and smoothing them sufficiently.
* 纹理滤波
texture_laws (Image, ImageEL, 'el', 5, 5)
texture_laws (Image, ImageLE, 'le', 5, 5)
texture_laws (Image, ImageES, 'es', 1, 5)
texture_laws (Image, ImageSE, 'se', 1, 5)
texture_laws (Image, ImageEE, 'ee', 2, 5)
* 合成一个通道
compose5 (ImageEL, ImageLE, ImageES, ImageSE, ImageEE, ImageLaws)
smooth_image (ImageLaws, ImageTexture, 'gauss', 3)
return ()

在这里插入图片描述

相关文章:

Halcon 频域缺陷检测

文章目录 傅里叶变换频谱矩形圆菱形黑白相间的亮带去除图纹&#xff08;反傅里叶变换&#xff09;去除图纹滤波器处理 Halcon 频域空间域检测缺陷Halcon 频域差分空间域 缺陷检测&#xff08;lines_gauss 提取线&#xff09;Halcon 频域差分空间域&#xff08;blob特征&#xf…...

架构整洁之道-软件架构-测试边界、整洁的嵌入式架构、实现细节

6 软件架构 6.14 测试边界 和程序代码一样&#xff0c;测试代码也是系统的一部分。甚至&#xff0c;测试代码有时在系统架构中的地位还要比其他部分更独特一些。 测试也是一种系统组件。 从架构的角度来讲&#xff0c;所有的测试都是一样的。不论它们是小型的TDD测试&#xff…...

nodejs学习计划--(十)会话控制及https补充

一、会话控制 1.介绍 所谓会话控制就是 对会话进行控制 HTTP 是一种无状态的协议&#xff0c;它没有办法区分多次的请求是否来自于同一个客户端&#xff0c; 无法区分用户 而产品中又大量存在的这样的需求&#xff0c;所以我们需要通过 会话控制 来解决该问题 常见的会话控制…...

fast.ai 机器学习笔记(四)

机器学习 1&#xff1a;第 11 课 原文&#xff1a;medium.com/hiromi_suenaga/machine-learning-1-lesson-11-7564c3c18bbb 译者&#xff1a;飞龙 协议&#xff1a;CC BY-NC-SA 4.0 来自机器学习课程的个人笔记。随着我继续复习课程以“真正”理解它&#xff0c;这些笔记将继续…...

LLM大模型常见问题解答(2)

对大模型基本原理和架构的理解 大型语言模型如GPT&#xff08;Generative Pre-trained Transformer&#xff09;系列是基于自注意力机制的深度学习模型&#xff0c;主要用于处理和生成人类语言。 基本原理 自然语言理解&#xff1a;模型通过对大量文本数据的预训练&#xff…...

这种学习单片机的顺序是否合理?

这种学习单片机的顺序是否合理&#xff1f; 在开始前我有一些资料&#xff0c;是我根据网友给的问题精心整理了一份「单片机的资料从专业入门到高级教程」&#xff0c; 点个关注在评论区回复“888”之后私信回复“888”&#xff0c;全部无偿共享给大家&#xff01;&#xff01…...

13 年后,我如何用 Go 编写 HTTP 服务(译)

原文&#xff1a;Mat Ryer - 2024.02.09 大约六年前&#xff0c;我写了一篇博客文章&#xff0c;概述了我是如何用 Go 编写 HTTP 服务的&#xff0c;现在我再次告诉你&#xff0c;我是如何写 HTTP 服务的。 那篇原始的文章引发了一些热烈的讨论&#xff0c;这些讨论影响了我今…...

flask+python高校学生综合测评管理系统 phl8b

系统包括管理员、教师和学生三个角色&#xff1b; 。通过研究&#xff0c;以MySQL为后端数据库&#xff0c;以python为前端技术&#xff0c;以pycharm为开发平台&#xff0c;采用vue架构&#xff0c;建立一个提供个人中心、学生管理、教师管理、课程类型管理、课程信息管理、学…...

【GameFramework框架内置模块】1、全局配置(Config)

推荐阅读 CSDN主页GitHub开源地址Unity3D插件分享简书地址 大家好&#xff0c;我是佛系工程师☆恬静的小魔龙☆&#xff0c;不定时更新Unity开发技巧&#xff0c;觉得有用记得一键三连哦。 一、前言 【GameFramework框架】系列教程目录&#xff1a; https://blog.csdn.net/q7…...

PySpark(四)PySpark SQL、Catalyst优化器、Spark SQL的执行流程、Spark新特性

目录 PySpark SQL 基础 SparkSession对象 DataFrame入门 DataFrame构建 DataFrame代码风格 DSL SQL SparkSQL Shuffle 分区数目 DataFrame数据写出 Spark UDF Catalyst优化器 Spark SQL的执行流程 Spark新特性 自适应查询(SparkSQL) 动态合并 动态调整Join策略 …...

2024第六届中国济南国际福祉及残疾人用品展览会/失能护理展

龘龘龙年-第六届山东福祉展会-将于5月27-29日在济南黄河国际会展中心举办&#xff1b; 一、引言 2024年&#xff0c;中国龙年&#xff0c;龙象征着力量、繁荣与希望。在这个特殊的年份&#xff0c;一场备受瞩目的盛会即将拉开帷幕。2024年第六届中国&#xff08;济南&#xf…...

SegmentAnything官网demo使用vue+python实现

一、效果&准备工作 1.效果 没啥好说的&#xff0c;低质量复刻SAM官网 https://segment-anything.com/ 需要提一点&#xff1a;所有生成embedding和mask的操作都是python后端做的&#xff0c;计算mask不是onnxruntime-web实现的&#xff0c;前端只负责了把rle编码的mask解…...

Java:字符集、IO流 --黑马笔记

一、字符集 1.1 字符集的来历 我们知道计算机是美国人发明的&#xff0c;由于计算机能够处理的数据只能是0和1组成的二进制数据&#xff0c;为了让计算机能够处理字符&#xff0c;于是美国人就把他们会用到的每一个字符进行了编码&#xff08;所谓编码&#xff0c;就是为一个…...

RabbitMQ之五种消息模型

1、 环境准备 创建Virtual Hosts 虚拟主机&#xff1a;类似于mysql中的database。他们都是以“/”开头 设置权限 2. 五种消息模型 RabbitMQ提供了6种消息模型&#xff0c;但是第6种其实是RPC&#xff0c;并不是MQ&#xff0c;因此不予学习。那么也就剩下5种。 但是其实3、4…...

项目02《游戏-14-开发》Unity3D

基于 项目02《游戏-13-开发》Unity3D &#xff0c; 任务&#xff1a;战斗系统之击败怪物与怪物UI血条信息 using UnityEngine; public abstract class Living : MonoBehaviour{ protected float hp; protected float attack; protected float define; …...

【Java数据结构】单向 不带头 非循环 链表实现

模拟实现LinkedList&#xff1a;下一篇文章 LinkedList底层是双向、不带头结点、非循环的链表 /*** LinkedList的模拟实现*单向 不带头 非循环链表实现*/ class SingleLinkedList {class ListNode {public int val;public ListNode next;public ListNode(int val) {this.val …...

【ES6】模块化

nodejs遵循了CommonJs的模块化规范 导入 require() 导出 module.exports 模块化的好处&#xff1a; 模块化可以避免命名冲突的问题大家都遵循同样的模块化写代码&#xff0c;降低了沟通的成本&#xff0c;极大方便了各个模块之间的相互调用需要啥模块&#xff0c;调用就行 …...

腾讯云4核8G服务器可以用来干嘛?怎么收费?

腾讯云4核8G服务器适合做什么&#xff1f;搭建网站博客、企业官网、小程序、小游戏后端服务器、电商应用、云盘和图床等均可以&#xff0c;腾讯云4核8G服务器可以选择轻量应用服务器4核8G12M或云服务器CVM&#xff0c;轻量服务器和标准型CVM服务器性能是差不多的&#xff0c;轻…...

怎么在bash shell中操作复杂json对象

怎么在bash shell中操作复杂json对象 在bash shell中操作复杂JSON对象&#xff0c;jq可以帮助我们在bash环境下轻松地处理这类数据&#xff0c;本文将详细介绍如何使用jq在bash中操作复杂的JSON对象。 jq是一个轻量级且灵活的命令行JSON处理器&#xff0c;它允许你以非常高效的…...

11.div函数

文章目录 函数简介1.函数原型2.div_t结构体3.引用头文件 代码运行 函数简介 1.函数原型 div_t div(int numerator, int denominator);div函数把numerator除以denominator&#xff0c;产生商和余数&#xff0c;用一个div_t的结构体返回。 2.div_t结构体 typedef struct _div…...

windows11 MSYS2下载安装教程

MSYS2 可以理解为在windows平台上模拟linux编程环境的开源工具集 当前环境&#xff1a;windows11 1. 下载 官网地址可下载最新版本&#xff0c;需要科学上网 https://www.msys2.org/ 2. 安装 按照正常安装软件流程一路next就可以 打开 3. 配置环境 网上很多教程提到需…...

Excel+VBA处理高斯光束

文章目录 1 图片导入与裁剪2 获取图片数据3 数据拟合 1 图片导入与裁剪 插入图片没什么好说的&#xff0c;新建Excel&#xff0c;【插入】->【图片】。 由于图像比较大&#xff0c;所以要对数据进行截取&#xff0c;选中图片之后&#xff0c;点击选项卡右端的【图片格式】…...

如何启动若依框架

Mysql安装 一、下载 链接&#xff1a;https://pan.baidu.com/s/1s8-Y1ooaRtwP9KnmP3rxlQ?pwd1234 提取码&#xff1a;1234 二、安装(解压) 下载完成后我们得到的是一个压缩包&#xff0c;将其解压&#xff0c;我们就可以得到MySQL 5.7.24的软件本体了(就是一个文件夹)&…...

案例:CentOS8 在 MySQL8.0 实现半同步复制

异步复制 MySQL 默认的复制即是异步的&#xff0c;主库在执行完客户端提交的事务后会立即将结果返给给客户端&#xff0c;并不关心从库是否已经接收并处理&#xff0c;这样就会有一个问题&#xff0c;主节点如果 crash 掉了&#xff0c;此时主节点上已经提交的事务可能并没有传…...

阿里云带宽计费模式怎么选?如何收费的?

阿里云服务器带宽计费模式分为“按固定带宽”和“按使用流量”&#xff0c;有什么区别&#xff1f;按固定带宽是指直接购买多少M带宽&#xff0c;比如1M、5M、10M、100M等&#xff0c;阿里云直接分配用户所购买的带宽值&#xff0c;根据带宽大小先付费再使用&#xff1b;按使用…...

c#记录几个问题

最近在看c#&#xff0c;有几个问题记录下 1&#xff09;全局变量&#xff0c;其实是声明一个public static类&#xff0c;里面包含一些public static变量和函数&#xff0c;也就是在程序开始运行后就创生了一个对应的存储空间&#xff0c;调用时就要写明是谁的什么变量。针对的…...

第69讲后端登录逻辑实现

Admin实体&#xff1a; TableName("t_admin") Data public class Admin {TableId(type IdType.AUTO)private Integer id; // 编号private String userName; // 用户名private String password; // 密码TableField(select false)private String newPassword; // 新…...

Qt 字符串类应用与常用基本数据类型

目录 操作字符串 查询字符串 Qt 常见数据类型 操作字符串 创建一个控制台项目 &#xff08;1&#xff09;QString提供一个二元的 “” 操作符&#xff0c;主要用于组合两个字符串。QString str1 "Hello World 传递给QString一个 const char* 类型的ASCII字符串 “He…...

JAVA面试题15

当然&#xff0c;我可以提供给您一些常见的Java面试题及其答案。以下是一些示例&#xff1a; 什么是Java的四种基本数据类型&#xff1f; 答案&#xff1a;Java的四种基本数据类型是整型&#xff08;byte、short、int、long&#xff09;、浮点型&#xff08;float、double&…...

git安装及使用

1、下载git 官网 Windows系统Git安装教程&#xff08;详解Git安装过程&#xff09; 官网打不开的话&#xff0c;可以使用镜像地址 镜像地址 2、使用git Git的下载、安装与使用(Windows) 30分钟带你精通git使用 3、注册github https://github.com/ 4、github文档 h…...

电力负荷预测 | Matlab实现基于LSTM长短期记忆神经网络的电力负荷预测模型(结合时间序列)

文章目录 效果一览文章概述源码设计参考资料效果一览 文章概述 电力负荷预测 | Matlab实现基于LSTM长短期记忆神经网络的电力负荷预测模型(结合时间序列) 所谓预测,就是指通过对事物进行分析及研究,并运用合理的方法探索事物的发展变化规律,对其未来发展做出预先估计和判断…...

力扣:455. 分发饼干

贪心解法思路&#xff1a; 1.先把两个数组按顺序遍历好&#xff0c;之后用最大的饼干来喂最大的胃口&#xff0c;如果最大的饼干不能喂饱最大的胃口&#xff0c;就除去这个最大的胃口&#xff0c;在剩下的为胃口中找最大的胃口来进行比对。这题主要历用了通过局部的优解&#…...

SpringCloud-项目引入Nacos

一、安装Nacos服务 首先&#xff0c;我们需要从 Nacos 的官方网站下载发布版本。下载地址&#xff1a;Releases alibaba/nacos GitHub 选择合适的版本并下载&#xff0c;解压缩得到 Nacos 的安装包。 在解压后的 Nacos 目录中&#xff0c;找到 bin 文件夹。 用写字板编辑…...

如何在 Windows 10/11 上恢复回收站永久删除的文件夹?

经验丰富的 Windows 用户将使用 Windows 备份和还原或文件历史记录来恢复不在回收站中的已删除文件夹。这些工具确实有助于 Windows 文件夹恢复&#xff0c;但并不总是有效。现在有许多专用的 Windows 数据恢复软件和免费解决方案可以替代它们&#xff0c;为 Windows 用户提供了…...

七、滚动条操作——调整图像对比度

对比度调整&#xff1a;是在原来图像基础上进行相应的公式调整&#xff0c;是类似乘法操作&#xff0c;本身像数值越大&#xff0c;对比度增加之后其与低像素点值差距越大&#xff0c;导致对比增强 项目最终效果&#xff1a;通过滚动条trackbar来实现调整图片亮度的功能 我这里…...

免费生成ios证书的方法(无需mac电脑)

使用hbuilderx的uniapp框架开发移动端程序很方便&#xff0c;可以很方便地开发出移动端的小程序和app。但是打包ios版本的app的时候却很麻烦&#xff0c;官方提供的教程需要使用mac电脑来生成证书&#xff0c;但是mac电脑却不便宜&#xff0c;一般的型号都差不多上万。 因此&a…...

gtkmm4 应用程序使用 CSS 样式

文章目录 前言css选择器css文件示例源代码效果动态设置css-classes 前言 程序样式和代码逻辑分离开 使代码逻辑更可观 css选择器 Cambalache提供了两种css-classes 相当于css里的类名:class“类名”css-name 相当于css里的标签名:spin div p 啥的 如上我设置了这个按钮控件的…...

科研绘图-半小提琴图-

文章目录 前言1.软件安装-Origin 20222.绘制半小提琴图3.绘制径向条形图 前言 本文叙述记录的是一些科研绘图的实现方法&#xff0c;具体介绍从软件安装到实现图表绘制的详细过程。 1.软件安装-Origin 2022 Origin是一款具有丰富绘图功能的科研绘图软件&#xff0c;安装过程…...

机器学习 | 深入集成学习的精髓及实战技巧挑战

目录 xgboost算法简介 泰坦尼克号乘客生存预测(实操) lightGBM算法简介 《绝地求生》玩家排名预测(实操) xgboost算法简介 XGBoost全名叫极端梯度提升树&#xff0c;XGBoost是集成学习方法的王牌&#xff0c;在Kaggle数据挖掘比赛中&#xff0c;大部分获胜者用了XGBoost。…...

SNMP(简单网络管理协议)介绍

简介 作为系统管理员的重要工作之一是收集关于服务器和基础设施的准确信息。有许多工具和选项可用于收集和处理这种类型的信息。其中许多工具都是建立在一种称为SNMP的技术之上。 SNMP代表简单网络管理协议。这是服务器可以共享有关其当前状态的信息的一种方式&#xff0c;也…...

Spring中常见的设计模式

使用设计模式是为了可重用代码、让代码更容易被他人理解、保证代码可靠性、程序的重用性、更具有灵活、优雅&#xff0c;而Spring中共有九种常见的设计模式 工厂模式 工厂模式&#xff08;Factory Pattern&#xff09;是 Java 中最常用的设计模式之一。这种类型的设计模式属于…...

【MySQL】——数值函数的学习

&#x1f308;个人主页: Aileen_0v0 &#x1f525;热门专栏: 华为鸿蒙系统学习|计算机网络|数据结构与算法 ​&#x1f4ab;个人格言:“没有罗马,那就自己创造罗马~” #mermaid-svg-Z1fAnfrxGD7I5gqp {font-family:"trebuchet ms",verdana,arial,sans-serif;font-siz…...

LLMs模型选择,LLMs复读机问题,LLMs长文本处理方案

为什么会出现 LLMs 复读机问题&#xff1f; LLMs 复读机问题&#xff08;LLMs Parroting Problem&#xff09;是指大型语言模型&#xff08;LLMs&#xff09;在生成文本时可能出现的重复或重复先前输入内容的现象。出现LLMs复读机问题可能有以下几个原因&#xff1a; 数据偏差…...

LeetCode.144. 二叉树的前序遍历

题目 144. 二叉树的前序遍历 分析 这道题目是比较基础的题目&#xff0c;我们首先要知道二叉树的前序遍历是什么&#xff1f; 就是【根 左 右】 的顺序&#xff0c;然后利用递归的思想&#xff0c;就可以得到这道题的答案&#xff0c;任何的递归都可以采用 栈 的结构来实现…...

Redis复制

文章目录 1.Redis复制是什么2.Redis能干嘛3.权限细节4.基本操作命令5.常用三招5.1 一主二仆5.2 薪火相传5.3 反客为主 6.复制原理和工作流程7.复制的缺点 1.Redis复制是什么 就是主从复制&#xff0c;master以写为主&#xff0c;Slave以读为主。当master数据变化的时候&#x…...

C++入门学习(二十七)跳转语句—break语句

1、与switch语句联合使用 C入门学习&#xff08;二十三&#xff09;选择结构-switch语句-CSDN博客 #include <iostream> #include <string> using namespace std;int main() { int number;cout<<"请为《斗萝大路》打星(1~5※)&#xff1a;" &…...

Spark安装(Yarn模式)

一、解压 链接&#xff1a;https://pan.baidu.com/s/1O8u1SEuLOQv2Yietea_Uxg 提取码&#xff1a;mb4h tar -zxvf /opt/software/spark-3.0.3-bin-hadoop3.2.tgz -C /opt/module/spark-yarn mv spark-3.0.3-bin-hadoop3.2/ spark-yarn 二、配置环境变量 vim /etc/profile…...

1.4 Binance_interface API U本位合约行情

Binance_interface API U本位合约行情 Github地址PyTed量化交易研究院 1. API U本位合约行情接口总览 方法解释Pathget_ping测试服务器连通性 PING/fapi/v1/pingget_time获取服务器时间/fapi/v1/timeget_exchangeInfo获取交易规则和交易对/fapi/v1/exchangeInfoget_depth深度…...

单片机学习笔记---AT24C02(I2C总线)

目录 有关储存器的介绍 存储器的简介 存储器简化模型 AT24C02介绍 AT24C02引脚及应用电路 I2C总线介绍 I2C电路规范 开漏输出模式和弱上拉模式 其中一个设备的内部结构 I2C通信是怎么实现的 I2C时序结构 起始条件和终止条件 发送一个字节 接收一个字节 发送应答…...

c++恶魔轮盘制造第1期输赢

小常识&#xff0c;恶魔叫DEALER。 赢了很简单 void sheng() { cout<<"你获胜了&#xff01;";MessageBox(NULL,TEXT("你的钱~~~~~~给你"),TEXT("DEALER"),MB_OK);system("pause");system("cls"); } 输了我用了个选…...