C1_M3_Lab code question Ungraded lab

In the C1_M3_Lab code, image_folder_path defined as follows is never used.

image_folder_path = os.path.join(data_dir, “jpg”)

I think tar.extractall(data_dir) should be tar.extractall(image_folder_path)

Based on this version of the code, FlowerDataset relies of data_dir when initialising self.img_dir.

The downloaded tgz file stores all images inside jpg directory. So, extracting files inside jpg/jpg is not required.

image_folder_path can be removed if no references exist in rest of the notebook.

as per I see the m3 assignment code, the directory to the dataset is recalled by root_dir, and there is no image_folder_path, instead the retrieval of imgs is by self.root_dir under def statement of retrieve images.

I hope you are talking about the graded assignment only.

Hello !

It is used in the function

codes removed

→ Here:

    # Check if the primary data folder and a key label file already exist.
    if os.path.exists(image_folder_path) and os.path.exists(labels_file_path):
        # Inform the user that the dataset is already available locally.
        print(f"Dataset already exists. Loading locally from '{data_dir}'.")
        # Exit the function since no download is needed.
        return

It prevents the dataset from being downloaded again.
The downloaded .tgz file contains a jpg folder.
When the dataset is downloaded and extracted for the first time, this jpg folder is created.

→ The image_folder_path is used to check whether the folder already exists.
If it does, that means the data is already available on disk, so the function simply returns without downloading anything (=exits the function).

1 Like

is this ungraded lab?

I surely just checked again the graded assignment don’t have the code you mentioned.

I think topic header needs to mention if this ungraded lab codes.

okay this code is from ungraded lab.

and issue creator learner pointing on the extract files step seem same as per code mention target directory is data_dir, then that correct. I didn’t get why he wants image_folder_path as root directory?

Yep the ungraded one :+1:

I have changed topic header, thanks for adding up and correcting me.

1 Like