Hello! I’m sorry if this is a bad question–I’m relatively new to CNNs and still figuring out everything. I constructed a CNN for image classification (3 classes) and it’s been working properly and defining the images accurately. I can pass a single image through it using the following code:
As you can see, I can define the image path for the single image being classified as “./Final Testing Images/50”. However, I have a separate image folder on my computer that is constantly receiving images (so it’s not static; there are constantly new images in it) and I want the CNN to be able to pass each new image through the model and output its class. How would I accomplish this?
Thank you very much! I appreciate any help.
Depending on your use case you could use os.listdir
to check for the folder content and once a new image is detected you could execute it.
I thought of that–thank you! But, I was hoping to have this done automatically as images are added every 2-3 seconds. Is there any way to do that?
You could check torchserve
or NVIDIA/Triton Inference Server
to check if these serving applications would provide a convenient interface for it (I would assume so).
I’m sorry if this is a bad question–what is a serving application? I see what it is on Google, but how would I implement it?
TorchServe
and Triton
are applications to deploy models (serve them) using trained models and usually come with utils. to process new inputs (including batching) and to return responses to the user (e.g. via the web). I don’t know if this would fit your use case. If not, you might want to apply a custom solution using the initial suggestion.
OK, that makes sense. Thank you very much!
If that doesn’t work/I can’t create a custom solution, would you know of any other ways?