Resizing the image to 224*224 for resnet50

4 ビュー (過去 30 日間)
Darshana
Darshana 2023 年 6 月 15 日
回答済み: Darshana 2023 年 6 月 16 日
clc;
clear all;
close all;
path=dir('location');
n=length(path);
for i=3:n
str=path(i).name;
[p ,fname]=fileparts(str);
str=['location',str];
im=imread(str);
im=imresize(im,[224,224]);
im=im2gray(im);
% newmap = rgb2gray(map)
imwrite(im,strcat(fname,'.jpg'))
end

回答 (2 件)

Aakash
Aakash 2023 年 6 月 15 日
Ok so going by the tags associated with your question:
  1. Ensure images are present in the location folder.
  2. Modify the line str=['location',str] to str=['location/',str];
  2 件のコメント
Darshana
Darshana 2023 年 6 月 15 日
It shows error like get full file name or the file is not open for reading
Aakash
Aakash 2023 年 6 月 15 日
Looks like location folder is not in current directory where matlab is considering, so give full path of your location folder and check.

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


Darshana
Darshana 2023 年 6 月 16 日
Yes I figured out the problem.Thank you

Community Treasure Hunt

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

Start Hunting!

Translated by