how to save scatter plot of each row as image for image classification

Hello Everyone, I hope you are doing well.
i have the following data of shape 100x1000.
each row has 1000 samples
i want save scatter plot of each row as image to train image classification network How can i do that?

6 件のコメント

KSSV
KSSV 2022 年 3 月 4 日
I think each row has same number....how it will be a scatter plot? How you want to use such images for classification? What exactly you ar targetting?
Med Future
Med Future 2022 年 3 月 4 日
@KSSV like this is the scatterplot of first row , i want to save this kind of plot for each row automatically
Image Analyst
Image Analyst 2022 年 3 月 7 日
So your images are in the form of a row vector of 1000 pixels? How are you doing the classification? Are you using the Classification Learner app, or Deep Learning, or traditional methods?
Med Future
Med Future 2022 年 3 月 8 日
@Image Analyst yes i have row vector in which 1000 values. i want to convert it in image to train CNN . Can you please help me to save image
Image Analyst
Image Analyst 2022 年 3 月 9 日
OK, explain what I'm looking at here. How does this data relate to images? Why is the value the same for all columns and what does the value mean? What do the rows and columns represent? Is a column for each image, and the rows are the vector of values that you'd like to predict for each image? Probably not since all columns are the same so the predicted value would not change if you changed the image.
s = load('saveddata.mat')
data = s.fixedclass;
subplot(2, 1, 1);
imshow(data, []);
impixelinfo;
title('Data in Mat file')
subplot(2, 1, 2);
plot(data(:, 1), 'b.-', 'LineWidth', 2);
grid on;
title('First Column')
xlabel('Row');
ylabel('Value')
Med Future
Med Future 2022 年 3 月 9 日
@Image Analyst Each row has constant value , means it belongs to one class

サインインしてコメントする。

回答 (1 件)

KSSV
KSSV 2022 年 3 月 4 日
load('saveddata.mat') ;
for i = 1:100
plot(fixedclass(i,:),'.')
drawnow
filename = [num2str(fixedclass(i,1)),'.png'] ;
saveas(gcf,filename)
end

15 件のコメント

Med Future
Med Future 2022 年 3 月 4 日
@KSSV Thanks for your answer is it possible can i remove the the x and y axis values
yanqi liu
yanqi liu 2022 年 3 月 7 日
use
axis off
or
set(gca, 'XTickLabel', [], 'YTickLabel', [])
KSSV
KSSV 2022 年 3 月 7 日
You can also use:
I = uint8(zeros(1000)) ;
I(876,:) = 876 ;
imwrite(I,'876.png')
Med Future
Med Future 2022 年 3 月 8 日
@yanqi liu @KSSV what is i want to save image using pixel .
for example my data has row of 1000 values i want to save it as image without scatter plot
KSSV
KSSV 2022 年 3 月 9 日
You can do that using the second answer which I have given.
Med Future
Med Future 2022 年 3 月 9 日
@KSSV i dnt understand that can you please explain that?
Med Future
Med Future 2022 年 3 月 9 日
編集済み: Med Future 2022 年 3 月 9 日
@KSSV can you please apply it on my dataset?
How can i run it on each row?
KSSV
KSSV 2022 年 3 月 9 日
load('saveddata.mat') ;
for i = 1:100
I = uint8(zeros(100,1000)) ;
I(i,:) = fixedclass(i,:) ;
filename = [num2str(fixedclass(i,1)),'.png'] ;
imwrite(I,filename)
end
Med Future
Med Future 2022 年 3 月 9 日
@KSSV why this image has brighter line?
Med Future
Med Future 2022 年 3 月 9 日
@KSSV why this happening? thats not saving correct images
KSSV
KSSV 2022 年 3 月 9 日
Will check and get back tomorrow.
Med Future
Med Future 2022 年 3 月 9 日
Here is the file attached please run code on this dataset.
dataset shape 3000x1000 first 1000x1000 belongs to class 1. next 1000x1000 belongs to class 2 and next 1000x1000 belongs to class 3 to make total of 3000x1000
Med Future
Med Future 2022 年 3 月 10 日
@KSSV have you check it?
KSSV
KSSV 2022 年 3 月 10 日
I am confused and not clear what problem you faced and what you are expecting.
Med Future
Med Future 2022 年 3 月 10 日
@KSSV the code you share some image has brighter line and some has dark line

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeGet Started with Statistics and Machine Learning Toolbox についてさらに検索

製品

リリース

R2021b

質問済み:

2022 年 3 月 4 日

コメント済み:

2022 年 3 月 10 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by