Docsity

classificação de imagens matlab, Notas de estudo de Matlab

Pré-visualização parcial do texto

Baixe classificação de imagens matlab e outras Notas de estudo em PDF para Matlab, somente na Docsity!

Image Category Classification Using Bag of Features This example shows how to use a bag of features approach for image category classification. This technique is also often referred to as bag of words. Visual image categorization is a process of assigning a category label to animage This example uses: under test. Categories may contain images representing just about anything, for example, dogs, cats, trains, boats. Statistics and Machine Learning Toolbox Load Image Dataset Computer Vision Toolbox Unip a collection of images to use for this example. Open Live Script unzip('MerchData.zip'); Load the image collection using an imageDatastore to help you manage the data. Because imageDatastore operates on image file locations, and therefore does not load all the images into memory, itis safe to use on large image collections. imds = imageDatastore( 'MerchData”, 'IncludeSubfolders" true, 'LabelSource", 'foldernames'); You can easily inspect the number of images per category as well as category labels as shown below: tbl = countEachLabel (imds) tbl=5x2 table Label Count MathWorks Cap 15 MathWorks Cube 15 MathWorks Playing Cards 15 MathWorks Screndriver 15 MathWorks Torch 15 Note that the labels were derived from directory names used to construct the ImageDatastore, but can be customized by manually setting the Labels property of the ImageDatastore object. Next, display a few of the images to get a sense of the type of images being used. figure montage(imds.Files(1:16:end)) Note that for the bag of features approach to be effective, the majority of the object must be visible in the image. Prepare Training and Validation Image Sets Separate the sets into training and validation data. Pick 60% of images from each set for the training data and the remainder, 40%, for the validation data. Randomize the split to avoid biasing the results.