Hood Ubuntu Vanilla TensorFlow Install and Test 20210708
Contents
Tensorflow Install
Install Tensorflow - First Attempt
pip install tensorflow ... ... ERROR: launchpadlib 1.10.13 requires testresources, which is not installed. ... ...
Install Tensorflow - Second Attempt
sudo apt install python3-testresources ... pip install tensorflow ... ...
Optional Dependencies
Tensorflow Object Detection Models
I don't understand if I installed this later.
Tensorflow Slim
$ pip install --upgrade tf_slim ...
Testing
Finding a Test Set
- Tensorflow Install: started here
- Went to section "Build your first ML app"
- Select the Mobile developers link
- Select the "See examples" button
- Scroll to the "Object Detection" box in the middle of the top row.
- Select "Try it on Raspberry Pi" (I just guessed at this selection)
- Tensorflow lit object detection examples for Raspberry Pi
- Also see July 30, 2021 notes - referenced below for detailed notes
Downloading the Examples
I followed the instructions in the README.md file at the above link.
$ cd $ mkdir Tensorflow $ cd Tensorflow/ $ git clone https://github.com/tensorflow/examples --depth 1 $ cd Tensorflow/examples/courses/ $ ls udacity_deep_learning udacity_intro_to_tensorflow_lite udacity_intro_to_tensorflow_for_deep_learning $ cd udacity_intro_to_tensorflow_for_deep_learning/ $ ls l01c01_introduction_to_colab_and_python.ipynb l02c01_celsius_to_fahrenheit.ipynb l03c01_classifying_images_of_clothing.ipynb l04c01_image_classification_with_cnns.ipynb l05c01_dogs_vs_cats_without_augmentation.ipynb l05c02_dogs_vs_cats_with_augmentation.ipynb l05c03_exercise_flowers_with_data_augmentation.ipynb
Why I thought this would be interesting path to investigate, I not know. But this ended up matches a Udacity course I am taking. It is just the test I am looking for.
- Intro to Tensorflow for Deep Learning Free Udacity Course
Executing Lesson 3 from the Udacity Course
Install Jupyter
The jupyter install was done as part of the Tensorflow Foxy Alsora install referenced at the top of this page. See the Build section in the following link. It appears to come in handy here for extract Python source code.
Up Jupyter Notebook with Python 3 on Ubuntu 20.04 and Connect via SSH Tunneling] This may be an interesting link to follow up on.
$ pip install --user Cython contextlib2 jupyter matplotlib Pillow ... ...
Extracting and Executing Python Source in Notebook
$ cd ~/DeepLearning/fromExamples $ cp ~/Tensorflow/examples/courses/udacity_intro_to_tensorflow_for_deep_learning/l03c01_classifying_images_of_clothing.ipynb . $ ls l03c01_classifying_images_of_clothing.ipynb $ jupyter nbconvert --to script l03c01_classifying_images_of_clothing.ipynb [NbConvertApp] Converting notebook l03c01_classifying_images_of_clothing.ipynb to script [NbConvertApp] Writing 6784 bytes to l03c01_classifying_images_of_clothing.txt $ ls l03c01_classifying_images_of_clothing.ipynb l03c01_classifying_images_of_clothing.txt $ mv l03c01_classifying_images_of_clothing.txt l03c01_classifying_images_of_clothing.py $ cp l03c01_classifying_images_of_clothing.py l03c01_classifying_images_of_clothing.py.org $ python3 l03c01_classifying_images_of_clothing.py File "l03c01_classifying_images_of_clothing.py", line 35 !pip install -U tensorflow_datasets ^ SyntaxError: invalid syntax $ emacs l03c01_classifying_images_of_clothing.py & [2] 63731 $ diff l03c01_classifying_images_of_clothing.py.org l03c01_classifying_images_of_clothing.py 35c35 < !pip install -U tensorflow_datasets --- > # !pip install -U tensorflow_datasets $ python3 l03c01_classifying_images_of_clothing.py ... ...
- Appears to work like it does in the Colab Notebook. I am amazed.
- It is not clear when I installed the tensorflow_datasets
This gives me confidence that my vanilla Tensorflow install is working.
Aside: Running Jupyter
Open jupyter in web browser
$ jupyter notebook
Navigate to an *.ipynp file and click on it. The selected notebook appears in new browser window
Select "Run in Google colab". An active notebook appears in a new browser window.
- Running the Notebook
- How To Set Up Jupyter Notebook with Python 3 on Ubuntu 20.04 and Connect via SSH Tunneling: May be of interest.
Notes and Logs
The install Tensorflow Foxy install went badly. So I went for a simpler vanilla Tensorflow install that did not integrate with ROS2.