ver0.83--preproc_data.m

本文介绍了一种针对MNIST手写数字数据集的图像预处理方法。该方法通过调整图像大小、标准化像素值来提高后续处理的效果。文章详细阐述了如何实现图像数据的随机选择、尺寸扩展以及归一化。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

function [pd,labnew] = preproc_data(id,n,labels,rand_on)
%preproc_data MNIST手写图像数据库预处理。
%
%  Syntax
%  
%    [pd,labnew] = preproc_data(id,n,labels,rand_on)
%    
%  Description
%   Input:
%    id - 图像28×28大小的单元阵列
%    n - 要处理的图像数
%    labels - 单元阵列的标签,对应于图像
%    rand_on - 参数,定义是否有必要随机选取一对图像/标签
%   Output:
%    pd - 处理图像的单元阵列具有0平均值,1标准偏差和尺寸增加(从28x28到32x32)
%    labnew - 对应于该图像的标签单元阵列

for k=1:n
    if(rand_on==1)        
        rand_num = ceil(rand(1,1)*length(id));
    else
        rand_num = k;
    end
    labnew(k) = labels(rand_num);
    randd{k} = zeros(32,32);
    randd{k}(3:30,3:30)=double(id{rand_num});
    %pd{k} = reshape(mapstd(reshape(randd{k},1,[])),32,32);
    gain = 1./ std(randd{k}(:));
    pd{k} = (randd{k} - mean(randd{k}(:))).*gain;        
end

[0]**** Build of configuration Debug for project Lab4 **** [1]"C:\\ti\\ccs2010\\ccs\\utils\\bin\\gmake" -k -j 16 all -O [2]Building file: "../main.c" [3]Invoking: MSP430 Compiler [4]"C:/ti/ccs2010/ccs/tools/compiler/ti-cgt-msp430_21.6.1.LTS/bin/cl430" -vmspx --data_model=restricted --use_hw_mpy=F5 --include_path="C:/ti/ccs2010/ccs/ccs_base/msp430/include" --include_path="C:/Users/14665/workspace_ccstheia/Lab4" --include_path="C:/Users/14665/workspace_ccstheia/Lab4/driverlib/MSP430F5xx_6xx" --include_path="C:/ti/ccs2010/ccs/tools/compiler/ti-cgt-msp430_21.6.1.LTS/include" --advice:power="none" --define=__MSP430F5529__ --define=DEPRECATED -g --printf_support=minimal --diag_warning=225 --diag_wrap=off --display_error_number --silicon_errata=CPU21 --silicon_errata=CPU22 --silicon_errata=CPU23 --silicon_errata=CPU40 --preproc_with_compile --preproc_dependency="main.d_raw" "../main.c" [5]>> Compilation failure [6]subdir_rules.mk:9: recipe for target 'main.obj' failed [7]"../main.c", line 26: error #20: identifier "CSCTL0_H" is undefined [8]"../main.c", line 26: error #20: identifier "CSKEY_H" is undefined [9]"../main.c", line 27: error #20: identifier "CSCTL1" is undefined [10]"../main.c", line 27: error #20: identifier "DCOFSEL_6" is undefined [11]"../main.c", line 28: error #20: identifier "CSCTL2" is undefined [12]"../main.c", line 29: error #20: identifier "CSCTL3" is undefined [13]"../main.c", line 46: error #20: identifier "P4SEL1" is undefined [14]"../main.c", line 47: error #20: identifier "P4SEL0" is undefined [15]"../main.c", line 55: error #20: identifier "UCA1MCTLW" is undefined [16]"../main.c", line 91: warning #1-D: last line of file ends without a newline [17]9 errors detected in the compilation of "../main.c". [18]gmake: *** [main.obj] Error 1 [19]gmake: Target 'all' not remade because of errors. [20]**** Build Finished 报错了
最新发布
06-16
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值