Closed johnypark closed 2 years ago
Hey John! You’ll need to install it in Colab.
can you try running:
!pip install keras-cv
in a cell? Please note Colab may not have the newest version of TensorFlow yet, so we may need to wait on that.
I’ll try to get KerasCV included in Colab as well. Thanks for the feedback!
Just looked again John! You need to upgrade to TensorFlow 2.9
can you run
pip install —upgrade tensorflow
?
Run this cell:
%%bash
git clone https://github.com/keras-team/keras-cv.git
mv keras-cv/keras_cv /content/keras_cv
pip uninstall tensorflow -y
pip install tf-nightly==2.10.0.dev20220427
pip uninstall keras -y
pip install keras-nightly==2.10.0.dev2022042807
import keras_cv
The library is currently using a nightly version of TensorFlow and Keras for development. This is what we are using, give it a shot.
Hi @LukeWood @adhadse Thank you for your prompt responses!
Upgrading TensorFlow to 2.9. worked.
So is there a big difference between the nightly version and the 2.9 version of keras-cv?
I am interested in using the RandAugment layer, would you recommend using the nightly version?
Thank you, John
More in general with https://github.com/keras-team/keras-cv/pull/417 we have removed the wheel/install dependency.
So now we have only rely to a runtime check: https://github.com/keras-team/keras-cv/blob/master/keras_cv/version_check.py
But If tensorflow is not installed and we install only keras_cv in a fresh venv/container:
import keras_cv
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.10/site-packages/keras_cv/__init__.py", line 15, in <module>
from keras_cv import layers
File "/usr/local/lib/python3.10/site-packages/keras_cv/layers/__init__.py", line 15, in <module>
from tensorflow.keras.__internal__.layers import BaseImageAugmentationLayer
ModuleNotFoundError: No module named 'tensorflow'
Hi @LukeWood @adhadse Thank you for your prompt responses!
Upgrading TensorFlow to 2.9. worked.
So is there a big difference between the nightly version and the 2.9 version of keras-cv?
I am interested in using the RandAugment layer, would you recommend using the nightly version?
Thank you, John
Hey John, I'd recommend TensorFlow 2.9. Nightly is released every night, 2.9 is a vetted, thoroughly tested release.
p.s. @johnypark let me know what you use our RandAugment for! Really interested in seeing it!
@LukeWood Thank you!
I would love to elaborate on what I am working on. We are doing a fine-grained classification task for herbarium specimen images (plant images), to help botanists with more efficient biodiversity discovery. Since herbaria around the world have about 30M high-resolution images of very well curated 400K plant labels, we think it would be worth the intention from the vision community as well. We also host an annual competition through Kaggle (https://www.kaggle.com/competitions/herbarium-2022-fgvc9)!
@LukeWood @qlzh727 I will reconsider this or please open a related ticket as this kind of behavior is really user unfriendly. See again my comment at https://github.com/keras-team/keras-cv/issues/442#issuecomment-1131831501
@LukeWood @qlzh727 I will reconsider this or please open a related ticket as this kind of behavior is really user unfriendly. See again my comment at #442 (comment)
Perhaps we should specify a >= relationship with 2.9.0. Can we do this in setup.py dependencies? Or will this require us to use requirements.txt
Yes you could do this in setup.py
or requirements.txt
as you like:
https://packaging.python.org/en/latest/discussions/install-requires-vs-requirements/
The problem is more about CPU/GPU TF. If we don't want to publish two Keras-cv wheels the alternatives are a bit ugly: https://github.com/tensorforce/tensorforce/issues/31
I see, maybe we can opt the root init.py out of linting so we can run the version check before we import layers.
Keras totally ignore that we have two distinct upstream wheels (CPU/GPU) and depend on GPU:
https://github.com/keras-team/keras/blob/master/requirements.txt#L6
Keras totally ignore that we have two distinct upstream wheels (CPU/GPU) and depend on GPU:
https://github.com/keras-team/keras/blob/master/requirements.txt#L6
From your perspective is this problematic or ok? AFAIK tensorflow works on both GPU and CPU on unix based OSes.
From your perspective is this problematic or ok? AFAIK tensorflow works on both GPU and CPU on unix based OSes.
Honestly if you want my opinion it is mainly a disk space topic on your environment:
CPU+GPU: tensorflow-2.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (511.7 MB)
CPU: tensorflow_cpu-2.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (207.5 MB)
So compressed is already more then 2.5x.
Note that keras (as part of the tf API) doesn't list any dependency by itself. It always get its needed package from tensorflow. The requirements.txt in keras repo is purely for test purpose (local env setup). End user will always access keras package via pip install tensorflow package.
As of Keras CV, since it relies on tf/keras, we should config proper version dependency for it, so that CV nightly will install tf/keras-nightly, same for formal release version.
@qlzh727 Yes I know this but I've mentioned it cause we have already a parallel CI/dev_env ticket at https://github.com/keras-team/keras-cv/issues/440
Ack. Will comment on #440.
Getting this with the latest CAO Oct 2023.
First, thank you so much to all the contributors for their tremendous effort in building keras-cv.
Obviously, I would like to try it out, but in colab I could not load keras-cv:
https://colab.research.google.com/drive/1k-IrSJF-DlP_o27ohr7GvYsXliGRifTF?usp=sharing
Above is the error message I am getting. What am I missing? Any suggestions would be appreciated.
Thank you, John