Greetings,
I am trying to implement the VGG19 neural network. I have downloaded the imagenet dataset and am testing a few classes.
I have figured out that NetEncoder can be used to resize images for training but am struck with resizing the images for testing.
I am using the following line of code to import the images into testData variable.
Now my problem is that the images in the folder are of various sizes and i want to resize all of them to 224 x 224 so that i can use it to test my network.
I have tried using
testData2=ImageResize[testData,{224,224}];
but it has resulted in error.
EDIT :Forgot to mention that there are two sub folders in the path. Problem has been resolved, Thank you.
Import::elemstx: ImageSize->{224,224} is not a valid format or element specification. Expecting a string, list, or integer.
General::stop: Further output of Import::elemstx will be suppressed during this calculation.
The code the Piotr suggested should work (if you are up-to-date with Mathematica version (I am sure this works at least on 11.1)).
To be on the safe side, you could also try doing following:
I am using MMA version 11.2.
I have tried implementing your code but was hit by the following error:
Out[3]={}
I have tried to get RandomSample
RandomSample[testData, 3]
and got the following error:
RandomSample::smplen: RandomSample cannot generate a sample of length 3, which is greater than the length of the sample set {}. If you want a choice of possibly repeated elements from the set, use RandomChoice.
Thanks for your solution but it seems it is not working to my problem.
There are two sub folders in that folder namely dogs and cars, maybe that is causing some problem?
I just wanted to check whether the images have been imported or not using RandomSample.
When I run the code you suggested it gave the following output:
Out[3]=0
I am new to MMA so I apologize for any inconvenience caused.