0
$\begingroup$

I'm working on image classification using CNN, my dataset contains more than 50 classes (50 folders) which represent the types of car parts, and in each folder we have vehicle brands, each vehicle folder contains the images of the part taken in different sides: front, back, left , right, top, bottom. For example: a folder 'door' wil contain different brand of cars, in each car we will have images of the door tooken by different sides.

I have to create a model to recognize the type of the car part and also the side that the picture was taken. Please, can anyone suggest how can I use all these folders for my training dataset and how to recognize those two things ( type and side).

enter image description here

$\endgroup$
3
  • 1
    $\begingroup$ Can you draw some image to show the directory structure for the images $\endgroup$
    – 10xAI
    Apr 7, 2021 at 16:09
  • $\begingroup$ I added a picture to show you the structure. I just gave you some parts of cars ( driverdoor, doorhandler...) I actually have 6 folders. inside the folders I can have almost 1000 folders of cars, and inside them there are 6 images of that part. I hope that it is clear enough for you, thank you for helping me. Infact, this is a solution that was given to me and then i don't know if there is a better solution to do it in order to create a model to recognize the type of cars parts. $\endgroup$
    – Lema Zaidi
    Apr 7, 2021 at 23:44
  • $\begingroup$ why 6 folders? Does each one have the same file structure? $\endgroup$ Oct 8, 2022 at 20:20

1 Answer 1

0
$\begingroup$

You can try and use the tf.keras.preprocessing.image.ImageDataGenerator's flow-from_directory() method. Here are a few links for reference:

$\endgroup$
2
  • $\begingroup$ If i use flow-from_directory, than how can I specify all the cars because I have more than 20 folders of cars in each part, for example: train = flow_from_directory(data/train/driverdoor/car1) .... if someone could help, i will be so grateful, i'm lost and i can't move forward. $\endgroup$
    – Lema Zaidi
    Apr 8, 2021 at 13:55
  • $\begingroup$ Can't you concatenate all cars_1 and cars_2 subdirectories into one single ? That way you'll have only driverdoor/ and doorhandle/ with no subdirectories ? $\endgroup$
    – user105480
    Apr 8, 2021 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.