moelgendy / deep_learning_for_vision_systems

This repository accompanies the book "Deep Learning for Vision Systems".
329 stars 195 forks source link

Installation #31

Open Mel65 opened 2 years ago

Mel65 commented 2 years ago

I like the book but can't seem to install the software properly. That is a shame as it detracts from what is otherwise an excellent book! Many similar book suffer from this issue. I think more detail on installation would be very helpful. Is any help available?

moelgendy commented 2 years ago

Hi @Mel65! Thanks for reaching out. Did you try the setup instructions in the appendix at the end of the book? Please let me know what issues you are facing and would love to help you get set up.

Mel65 commented 2 years ago

Hi Mohamed Elgendy , Thank you for replying to my comment. First let me say how much I like the book. I have been searching for a good introductory text for my students (I am a University Lecturer). There are a lot of deep learning books on the market, but few are good as an introduction. Deep Learning Illustrated by J Krohn was the best I could find but I really wanted something more focused on vision tasks. Your book fits the bill for me. The problem I find with many books is that the example software can be difficult to run, either because libraries are out of date or there are small bugs – a nightmare for the novice. I think it very important (so much so that the book is almost useless without it) that the book’s software be easy to get up and running as it inspires confidence, acting as a springboard for the reader. If there are difficulties with getting the software to run, then the reader is distracted and can fail to learn and gain from the text. That has been my experience. I think the problem I was having with your book, and I realise this is a failing on my part, was concerned with environments, and perhaps which directory I need to be in when I run Jupyter notebook. I am not sure if I am now doing things correctly but at least I have all of your code working (up to chapter 6). In case this helps others, this is how I am running the code for the book Deep Learning for Vision Systems. I activate the environment I have created (by following instructions in the book) called “deep_learning_for_vision_systems” before I run Jupyter Notebook (I assume this is needed?). I open a command prompt window by typing CMD (in window at bottom left of desktop screen). I activate the environment for the book as follows: C:\Users\brl>conda activate deep_learning_for_vision_systems. (at this point you can install new libraries, eg with conda install or pip). I then change to the directory with the book code (not sure if this is strictly necessary): C:\Users\brl>cd C:\Mel\deep_learning_for_vision_systems. From there I run Jupyter Notebook: C:\Mel\deep_learning_for_vision_systems>jupyter notebook I still had a few problems with some of the code (I have so far only read up to Chapter 6 by the way), and solved these as follows:

chapter_3_cifar10_cnn I replaced the following two lines: y_train = keras.utils.to_categorical(y_train, num_classes) y_test = keras.utils.to_categorical(y_test, num_classes) With these: y_train = keras.utils.np_utils.to_categorical(y_train, num_classes) y_test = keras.utils.np_utils.to_categorical(y_test, num_classes) This program then ran OK – hooray!

Chapter 6 Project: Transfer learning exercise I had to install the following to get this program to run: pip install -U scikit-learn scipy matplotlib pip install tqdm

Mel


From: Mohamed Elgendy @.> Sent: 28 December 2021 16:17 To: moelgendy/deep_learning_for_vision_systems @.> Cc: Mel65 @.>; Mention @.> Subject: Re: [moelgendy/deep_learning_for_vision_systems] Installation (Issue #31)

Hi @Mel65https://github.com/Mel65! Thanks for reaching out. Did you try the setup instructions in the appendix at the end of the book? Please let me know what issues you are facing and would love to help you get set up.

— Reply to this email directly, view it on GitHubhttps://github.com/moelgendy/deep_learning_for_vision_systems/issues/31#issuecomment-1002180428, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APICF4TVNIPC7O2NXKV3ZETUTHPJPANCNFSM5KW2ZP3Q. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you were mentioned.Message ID: @.***>

Mel65 commented 2 years ago

Hi Mohamed Elgendy, I have now worked through the entire book and all the code. As I mentioned before, I like the book and have recommended to colleagues here at the University. If I can sort out the few remaining issues I am having with the code, I will also recommend to our students studying Machine Vision. I am not sure if you would like any feedback from me, but here are a few things that came to mind in case you produce a second edition. I think Chapter 10 might benefit from a slight rewrite. It is more difficult to follow than the rest of the book. It would be good to include something on:

SSD7 Training Tutorial (ssd7_training.ipynbhttp://localhost:8888/notebooks/chapter_07/ssd_implementatoin_keras/ssd7_training.ipynb) I get this error: ImportError: cannot import name 'Adam' from 'keras.optimizers'

Covnet Visualization (convnet visualization.ipynbhttp://localhost:8888/notebooks/chapter_09/convnet%20visualization.ipynb) and Deep Deam (DeepDream.ipynbhttp://localhost:8888/notebooks/chapter_09/deepdream/DeepDream.ipynb) I get this error: RuntimeError: tf.gradients is not supported when eager execution is enabled. Use tf.GradientTape instead.

I ran your GAN code (dcgan_fashion_mnist.ipynb) for 1000 epochs and did not get anything approaching the good results you show in the book (my results after 1000 epochs is attached, ie pretty much still noise). Given that I am using the book’s code and the same dataset, why do you think my results are so poor? The only thing I altered was the following line, based on what is said here: https://exerror.com/importerror-cannot-import-name-adam-from-keras-optimizers-error/ From this: from keras.optimizers import Adam To this: from tensorflow.keras.optimizers import Adam

Melvyn


From: Melvyn Smith @.> Sent: 31 December 2021 15:59 To: moelgendy/deep_learning_for_vision_systems @.> Subject: Re: [moelgendy/deep_learning_for_vision_systems] Installation (Issue #31)

Hi Mohamed Elgendy,

Thank you for replying to my comment. First let me say how much I like the book. I have been searching for a good introductory text for my students (I am a University Lecturer). There are a lot of deep learning books on the market, but few are good as an introduction. Deep Learning Illustrated by J Krohn was the best I could find but I really wanted something more focused on vision tasks. Your book fits the bill for me. The problem I find with many books is that the example software can be difficult to run, either because libraries are out of date or there are small bugs – a nightmare for the novice. I think it very important (so much so that the book is almost useless without it) that the book’s software be easy to get up and running as it inspires confidence, acting as a springboard for the reader. If there are difficulties with getting the software to run, then the reader is distracted and can fail to learn and gain from the text. That has been my experience.

I think the problem I was having with your book, and I realise this is a failing on my part, was concerned with environments, and perhaps which directory I need to be in when I run Jupyter notebook. I am not sure if I am now doing things correctly but at least I have all of your code working (up to chapter 6).

In case this helps others, this is how I am running the code for the book Deep Learning for Vision Systems. I activate the environment I have created (by following instructions in the book) called “deep_learning_for_vision_systems” before I run Jupyter Notebook (I assume this is needed?). I open a command prompt window by typing CMD (in window at bottom left of desktop screen). I activate the environment for the book as follows: C:\Users\brl>conda activate deep_learning_for_vision_systems. (at this point you can install new libraries, eg with conda install or pip). I then change to the directory with the book code (not sure if this is strictly necessary): C:\Users\brl>cd C:\Mel\deep_learning_for_vision_systems. From there I run Jupyter Notebook: C:\Mel\deep_learning_for_vision_systems>jupyter notebook

I still had a few problems with some of the code (I have so far only read up to Chapter 6 by the way), and solved these as follows:

chapter_3_cifar10_cnn

I replaced the following two lines:

y_train = keras.utils.to_categorical(y_train, num_classes) y_test = keras.utils.to_categorical(y_test, num_classes)

With these:

y_train = keras.utils.np_utils.to_categorical(y_train, num_classes) y_test = keras.utils.np_utils.to_categorical(y_test, num_classes)

This program then ran OK – hooray!

Chapter 6 Project: Transfer learning exercise

I had to install the following to get this program to run:

pip install -U scikit-learn scipy matplotlib

pip install tqdm

Mel


From: Mohamed Elgendy @.> Sent: 28 December 2021 16:17 To: moelgendy/deep_learning_for_vision_systems @.> Cc: Mel65 @.>; Mention @.> Subject: Re: [moelgendy/deep_learning_for_vision_systems] Installation (Issue #31)

Hi @Mel65https://github.com/Mel65! Thanks for reaching out. Did you try the setup instructions in the appendix at the end of the book? Please let me know what issues you are facing and would love to help you get set up.

— Reply to this email directly, view it on GitHubhttps://github.com/moelgendy/deep_learning_for_vision_systems/issues/31#issuecomment-1002180428, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APICF4TVNIPC7O2NXKV3ZETUTHPJPANCNFSM5KW2ZP3Q. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you were mentioned.Message ID: @.***>