Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chapter-4/2-similarity-search-level-1.ipynb Broken float division #169

Open
gitgithan opened this issue Feb 19, 2023 · 4 comments
Open

chapter-4/2-similarity-search-level-1.ipynb Broken float division #169

gitgithan opened this issue Feb 19, 2023 · 4 comments

Comments

@gitgithan
Copy link

def plot_images(filenames, distances):
    images = []
    for filename in filenames:
        images.append(mpimg.imread(filename))
    plt.figure(figsize=(20, 10))
    columns = 4
    for i, image in enumerate(images):
        ax = plt.subplot(len(images) / columns + 1, columns, i + 1)

ax = plt.subplot(len(images) / columns + 1, columns, i + 1) should be ax = plt.subplot(len(images) // columns + 1, columns, i + 1), subplot requires integers for specifying number of rows/cols

@sidgan
Copy link
Collaborator

sidgan commented Mar 20, 2023

Good catch! Can you send this as a PR?

@zoldaten
Copy link

zoldaten commented Apr 3, 2023

i have this error here:

IndexError                                Traceback (most recent call last)
Cell In[47], line 4
      1 for i in range(6):
      2     random_image_index = random.randint(0, num_images)
      3     distances, indices = neighbors.kneighbors(
----> 4         [feature_list[random_image_index]])
      5     # Don't take the first closest image as it will be the same image
      6     similar_image_paths = [filenames[random_image_index]] + \
      7         [filenames[indices[0][i]] for i in range(1, 4)]

IndexError: index 7999 is out of bounds for axis 0 with size 2176

how to fix ?

@gitgithan
Copy link
Author

@zoldaten You may have been affected by #164.
I am waiting for the authors to provide feedback on my first PR before going further.
It is difficult for readers to make edits for reasons like hardware limitations and jupyter cell output management.

@zoldaten
Copy link

zoldaten commented Apr 3, 2023

@gitgithan ok. hm, it starts working...
may be that was mix of pickle saves. i`ve tested stages of saves:
1.

pickle.dump(standard_feature_list, open('features-caltech101-resnet.pickle', 'wb'))
pickle.dump(filenames, open('filenames-caltech101.pickle','wb'))
pickle.dump(generator.classes, open('class_ids-caltech101.pickle',
                                    'wb'))
pickle.dump(filenames, open('filenames-caltech101.pickle', 'wb'))
pickle.dump(
    feature_list,
    open('features-caltech101-' + model_architecture + '.pickle', 'wb'))
pickle.dump(
    feature_list,
    open('features-caltech101-resnet-finetuned.pickle', 'wb'))

and moved saves every time not let them replace each other.
hm, works.

here`s my notebooks with depredations fixed:
notebooks.zip

manavrmoorthy pushed a commit to manavrmoorthy/Practical-Deep-Learning-Book that referenced this issue Aug 28, 2023
- removing deprecated files
- the gcloud sessions are not using the same runtime (so we need to re-download data) so writing outputs to gdrive to make sure things are running and outputs are accessible for subsequent notebooks in colab
- renaming 4/1 notebook - since it had underscores instead of hyphens, the colab link in the notebook was not working
- xception added to imports for notebook 1, since it is part of the model_maker
- PracticalDL#163 - fixed
- PracticalDL#164 - fixed
- PracticalDL#169 - fixed
- metric='angular' added for annoy as default arg will be removed in subsequent releases
- removing a duplicate PCA + Annoy section
- PracticalDL#170 - fixed
- time is a negligible factor here, and we do not need it in the plots (since we are using optimised accuracy calculation using numpy from issue 170) - hence, modifying the plots
- removing matplotlib.style.use('seaborn') since it is deprecated
- the final fine-tuning notebook uses Caltech256 features (as per the book), which do not exist, since fine-tuning was done on Caltech101 - hence, renaming those files to caltech101. Can we retain caltech101 to test?
- PracticalDL#167 - fixed, if the above is okay
- formatted the code

chapter 5:
- write_grads and batch_size params have been removed from callback, or will be removed in subsequent releases
- PracticalDL#174 - not able to replicate this issue
- added a pointer to the notebook that suggests that for tensorboard to work without a 403 Forbidden error on Colab, cookies need to be allowed (I faced this issue)
- notebook 3 in chapter 5 is the exact same as notebook 2 in chapter 2 - replaced the file directly
- the autokeras notebook in Colab is named autokeras-error.ipynb - where can we change this to autokeras.ipynb?
- fixing accuracy score calculation in the autokeras notebook
- formatted the code

chapter 6:
- including the download_sample_image function
- formatted the code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants