Effacer les filtres
Effacer les filtres

How to make equal number of images in each class.? which is the best method for this.

4 vues (au cours des 30 derniers jours)
Karthik K
Karthik K le 21 Juin 2018
Commenté : Karthik K le 25 Juin 2018
Say i have different classes of images, but they are not equal in number to train. some class of images are in 1000's, some are in 100's, some are below 50 and 10. How i can make them equal.? Which is the best method for this.After that i need to do feature extraction. So if i have good number of images in each class i can train well i guess.
  6 commentaires
KSSV
KSSV le 22 Juin 2018
YOu can't get x-ray image sin google? I think you shall get those.
Karthik K
Karthik K le 23 Juin 2018
if 10 classes i cant try it out friend. but here it is more than 100 classes. to make all of them equal its a bigger task. so thinking ti make it duplicate in with some rotation methods if any.

Connectez-vous pour commenter.

Réponses (1)

Image Analyst
Image Analyst le 22 Juin 2018
Try randsample() or randperm() to get the indexes of images to use.
  3 commentaires
Image Analyst
Image Analyst le 23 Juin 2018
Modifié(e) : Image Analyst le 23 Juin 2018
Of course it works. If you get directory listings of all the files of the various classes, and you wanted, say, 50 files of each class, you could get their indexes like this
class1 = dir('class1*.png'); % Get listing of all class 1 images.
class2 = dir('class2*.png'); % Get listing of all class 2 images.
numImagesToExtract = 50;
randomClass1Indexes = randperm(length(class1), numImagesToExtract);
randomClass2Indexes = randperm(length(class2), numImagesToExtract);
Now you have the indexes of the class* variables to use. Just use those indexes to get the filenames of the randomly chosen files to use. What did you do differently?
By the way, you did not make your question clear now. Saying "some class of images are in 1000's" is completely vague. This could mean "some classes have 1000's of images", or "in some classes, the feature values we extract have value in the 1000 to 10 thousand range" or any number of other interpretations. I have no idea what you intend, but my code extracts the same number of randomly-chosen image files from variables having file names in the different classes.
Karthik K
Karthik K le 25 Juin 2018
Sorry if my question is not understanding and clear. Here this code extracts the image index values. say if i have 60 images of class hand, out of these 60 images , 50 image index values are taken. But what i actually wanted is to create duplicate images which i have in each class. Say i am having 60 images in class hand. if i want the images to be 100, from 60 to 100 how can i duplicate (create copies of images) from the existing images which i have.
Since x ray images are taken in different angle, mean while i am thinking how can i make some rotation to the existing images when creating duplicate images.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by