C2W1_Assignment_Cats vs Dogs

Hello Viktor,

Thank you for sharing the screenshot of your error.

based on your screenshot your this grader cell has incorrect code

As explained in the previous shared link in this post where it explains according to the hint given please follow these step to make the corrections

  1. Hints tells you to use os.makedirs to create your intermediate subdirectories not direct directories for your root path. So as I already have mentioned your first line of code is os.makedirs(root_path).
  2. Your next codes should use/add(here adding or append does not mean literally using + but using tuple) os.path.join to add to the new directories to the root path. So tuple root_path and files you want to create with tuples mentioned first with the append code which is here os.path.join and then os.makedirs
  3. Follow the 2 point for all the 6 files required to create the expected output. The second point is literal way of explaining how you need to write the code.

Believe me I spend hours correcting these code when I was doing this assignment, so you will also get it!!!

Let me know if you have cleared this.
Once you have cleared this section, the split data grader cell first wants you to create a source_directory which is mentioned as SOURCE_DIR(be particular about this segment as maintaining capital and lower-case of the DIR are to be followed as mentioned)

so when you are creating a file it should go for filename to the os.listdir with the SOURCE_DIR)
next mention what your file will contain here use the addition symbol for your SOURCE_DIR and filename
next you need to mention if os.path.getsuze with tupling file should return with size of the file as greater than 0
next mention files append function to your filename or else print File is empty

Now you need to define training length, validation length, shuffled_set, training_set and validation_set with proper code line. use a similar code to shuffle ===>
your sets * random.sample(list, len(list)) shuffles a list

  • copyfile(source, destination) copies a file from source to destination
    then create copy file for training_set and validation_set separately where each set has your files which you can mention as source_file (SOURCE_DIR +filename) and for training_file + filename as you want. Later copy file and tuple your source_file and the file you append training files with file name. follow the similar instructions for the validation set for copy file.

P.S. I have told you all codes here in verbal written matter as you would learn more by trying yourself. Try following these instructions and see if you have cleared the test. If still not getting the desired result lemme know. Believe me when I had got the first cell by myself, I felt like I completed an exam :slight_smile:
So take a break, start fresh in early morning. You will get the codes if read these instructions and try the code accordingly you will clear these cells.

All the best


1 Like