Compute Mean Value of Train and Test Dataset of Caltech-256 dataset in matlab code

clc;
imPath = '/home/wangxiao/Downloads/Link to caltech_256_dataset/image_/ori_total_im_/';
imageFiles = dir(imPath);

train_txtFile = '/home/wangxiao/Downloads/caltech256_whole_data_/train_caltech_label.txt';
test_txtFile = '/home/wangxiao/Downloads/caltech256_whole_data_/test_caltech_label.txt';
train_list = importdata(train_txtFile);
test_list = importdata(test_txtFile);

train_R = 0; train_G = 0; train_B = 0;
test_R = 0; test_G = 0; test_B = 0;

for i = 1:size(train_list, 1)
train_im_name = train_list.textdata{i, 1} ;
train_image = imread([imPath, train_im_name]);
train_image = double(train_image);

train_R = train_R + mean(mean( train_image(:, :, 1) ));
train_G = train_G +mean(mean( train_image(:, :, 2) ));
train_B = train_B + mean(mean( train_image(:, :, 3) ));

end

for i = 1:size(test_list, 1)
test_im_name = test_list.textdata{i, 1} ;
test_image = imread([imPath, test_im_name]);
% imshow(test_image);
test_image = double(test_image);

test_R = test_R +mean(mean( test_image(:, :, 1) )) ;
test_G = test_G +mean(mean( test_image(:, :, 2) )) ;
test_B = test_B +mean(mean( test_image(:, :, 3) )) ;

end

mean_train_R = train_R / size(train_list, 1);
mean_train_G = train_G / size(train_list, 1);
mean_train_B = train_B / size(train_list, 1);

mean_test_R = test_R / size(test_list, 1);
mean_test_G = test_G / size(test_list, 1);
mean_test_B = test_B / size(test_list, 1);

Compute Mean Value of Train and Test Dataset of Caltech-256 dataset in matlab code的更多相关文章

  1. Matlab Code for Visualize the Tracking Results of OTB100 dataset

    Matlab Code for Visualize the Tracking Results of OTB100 dataset 2018-11-12 17:06:21 %把所有tracker的结果画 ...

  2. 判断dataset是否被修改—DataSet.HasChanges 方法

    DataSet.HasChanges 方法 获取一个值,该值指示 DataSet 是否有更改,包括新增行.已删除的行或已修改的行. 命名空间:   System.Data程序集:  System.Da ...

  3. DataSet 取值,DataSet行数,DataSet列数 从DataSet中取出特定值

    1 DataSet.Table[0].Rows[ i ][ j ] 其中i 代表第 i 行数, j 代表第 j 列数 2 DataSet.Table[0].Rows[ i ].ItemArray[ j ...

  4. Debugger DataSet 调试时查看DataSet

    delphi  跟踪调试的时候查看DataSet数据记录 Ctrl+F7调试 增强工具DataSethttp://edn.embarcadero.com/article/40268 http://do ...

  5. [TensorFlow 团队] TensorFlow 数据集和估算器介绍

    发布人:TensorFlow 团队 原文链接:http://developers.googleblog.cn/2017/09/tensorflow.html TensorFlow 1.3 引入了两个重 ...

  6. [TensorFlow] Introduction to TensorFlow Datasets and Estimators

    Datasets and Estimators are two key TensorFlow features you should use: Datasets: The best practice ...

  7. TensorFlow高层封装:从入门到喷这本书

    目录 TensorFlow高层封装:从入门到喷这本书 0. 写在前面 1. TensorFlow高层封装总览 2. Keras介绍 2.1 Keras基本用法 2.2 Keras高级用法 3. Est ...

  8. deeplearning 源码收集

    Theano – CPU/GPU symbolic expression compiler in python (from MILA lab at University of Montreal) To ...

  9. [Tensorflow] 使用 tf.train.Checkpoint() 保存 / 加载 keras subclassed model

    在 subclassed_model.py 中,通过对 tf.keras.Model 进行子类化,设计了两个自定义模型. import tensorflow as tf tf.enable_eager ...

随机推荐

  1. 理解Mach Port

    参考文档: 1. http://robert.sesek.com/thoughts/2012/1/debugging_mach_ports.html 2. Mach 3 Kernel Interfac ...

  2. poj1181 大数分解

    //Accepted 164 KB 422 ms //类似poj2429 大数分解 #include <cstdio> #include <cstring> #include ...

  3. UIViewController添加子控制器(addChildViewController)

    // //  TaskHallViewController.m //  yybjproject // //  Created by bingjun on 15/10/27. //  Copyright ...

  4. BZOJ 1045 糖果传递

    奇怪的式子.最后发现取中位数. #include<iostream> #include<cstdio> #include<cstring> #include< ...

  5. Error Handling and Exception

    The default error handling in PHP is very simple.An error message with filename, line number and a m ...

  6. App Store审核指南:WatchKit、HealthKit、ApplePay以及HomeKit部分

    将此前App Store审核指南中的WatchKit.HealthKit.ApplePay以及HomeKit部分进行了整理和摘取. 10. 用户界面 10.1 应用程序必须遵守苹果的<Apple ...

  7. VM设置BIOS延长时间

    更改文件中的 bios.bootDelay = "XXXX"

  8. Balance_01背包

    Description Gigel has a strange "balance" and he wants to poise it. Actually, the device i ...

  9. Investment_完全背包

    Description John never knew he had a grand-uncle, until he received the notary's letter. He learned ...

  10. WPF文本框密码框添加水印效果

    WPF文本框密码框添加水印效果 来源: 阅读:559 时间:2014-12-31 分享: 0 按照惯例,先看下效果 文本框水印 文本框水印相对简单,不需要重写模板,仅仅需要一个VisualBrush ...