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. Form表单的操作

    form对象 <form name=“form1” action=“login.php” method=“post”></form> form对象的属性 name:表单名称 m ...

  2. DP重新学

    白书上的DP讲义:一 二 DAG上的dp 不要好高骛远去学这种高端东西,学了也写不对,剩下的几天把基本的dp和搜索搞下,就圆满了.不要再学新算法了,去九度把现有的算法写个痛. 学了数位DP和记忆搜索, ...

  3. Ubuntu系统启用Apache Mod_rewrite模块

    在终端中执行 sudo a2enmod rewrite 指令后,即启用了 Mod_rewrite 模块. 另外,也可以通过将 /etc/apache2/mods-available/rewrite.l ...

  4. Some SQL basics

    1, Index An index is a set of data pointers stored on disk associated with a single table. The main ...

  5. Zipper_DP

    Description Given three strings, you are to determine whether the third string can be formed by comb ...

  6. 7、SQL基础整理(子查询)

    子查询 (用来进行两个或以上表之间的查询) 1.首先新建一个bumen表和一个haha表,填充数据 2.利用两表进行子查询: --部门人数大于5的部门中最大年龄的人的信息--- select MAX( ...

  7. 插入并列div使其居中

    <!doctype html><html> <head> <meta charset="UTF-8"> <meta name= ...

  8. Web 数据可视化

    /***************************************************************************************** * Web 数据可 ...

  9. jquery zclip 复制黏贴功能不能实现

    按照http://www.steamdev.com/zclip/我实现一个简单的zclip test 以下是我的测试code: <!DOCTYPE html> <html> & ...

  10. 给linux添加一个回收站

    http://blog.chinaunix.net/uid-26805356-id-3492419.html 都知道linux没有回收站,如果一不小心 rm -rf之后,很难恢复,所以就编写了一个回收 ...