deep learning – Install issues with lr_utils in python

deep learning – Install issues with lr_utils in python

As per the answer above, lr_utils is a part of the deep learning course and is a utility to download the data sets. It should readily work with the paid version of the course but in case you lost access to it, I noticed this github project has the lr_utils.py as well as some data sets

https://github.com/andersy005/deep-learning-specialization-coursera/tree/master/01-Neural-Networks-and-Deep-Learning/week2/Programming-Assignments

Note:
The chinese website links did not work when I looked at them. Maybe the server storing the files expired. I did see that this github project had some datasets though as well as the lr_utils file.

Download the datasets from the answer above.

And use this code (Its better than the above since it closes the files after usage):

def load_dataset():
    with h5py.File(datasets/train_catvnoncat.h5, r) as train_dataset:
        train_set_x_orig = np.array(train_dataset[train_set_x][:])
        train_set_y_orig = np.array(train_dataset[train_set_y][:])

    with h5py.File(datasets/test_catvnoncat.h5, r) as test_dataset:
        test_set_x_orig = np.array(test_dataset[test_set_x][:])
        test_set_y_orig = np.array(test_dataset[test_set_y][:])
        classes = np.array(test_dataset[list_classes][:])

    train_set_y_orig = train_set_y_orig.reshape((1, train_set_y_orig.shape[0]))
    test_set_y_orig = test_set_y_orig.reshape((1, test_set_y_orig.shape[0]))

    return train_set_x_orig, train_set_y_orig, test_set_x_orig, test_set_y_orig, classes

deep learning – Install issues with lr_utils in python

You will be able to find the lr_utils.py and all the other .py files (and thus the code inside them) required by the assignments:

  1. Go to the first assignment (ie. Python Basics with numpy) – which you can always access whether you are a paid user or not

  2. And then click on Open button in the Menu bar above. (see the image below)

    src=https://i.stack.imgur.com/IxZxZ.png/.

Then you can include the code of the modules directly in your code.

Leave a Reply

Your email address will not be published.