keras-team / keras-cv

Industry-strength Computer Vision workflows with Keras
Other
1.01k stars 330 forks source link

Getting issue while importing keras_cv #1678

Closed SammyCoder2023 closed 1 year ago

SammyCoder2023 commented 1 year ago

Versions : Python 3.11.2, tensor Flow 2.12.0

Error Trace "You do not have Waymo Open Dataset installed, so KerasCV Waymo metrics are not available. Traceback (most recent call last): File "C:\Users\ADMIN\Desktop\Project\DiscordServer\testSD.py", line 2, in import keras_cv File "C:\Python311\Lib\site-packages\keras_cv__init.py", line 22, in from keras_cv import datasets File "C:\Python311\Lib\site-packages\keras_cv\datasets__init.py", line 14, in from keras_cv.datasets import pascal_voc File "C:\Python311\Lib\site-packages\keras_cv\datasets\pascal_voc\init.py", line 14, in from keras_cv.datasets.pascal_voc.load import load File "C:\Python311\Lib\site-packages\keras_cv\datasets\pascal_voc\load.py", line 16, in import tensorflow_datasets as tfds File "C:\Python311\Lib\site-packages\tensorflow_datasets\init.py", line 43, in import tensorflow_datasets.core.logging as _tfds_logging File "C:\Python311\Lib\site-packages\tensorflow_datasets\core\init.py", line 22, in from tensorflow_datasets.core import community File "C:\Python311\Lib\site-packages\tensorflow_datasets\core\community\init__.py", line 18, in from tensorflow_datasets.core.community.huggingface_wrapper import mock_builtin_to_use_gfile File "C:\Python311\Lib\site-packages\tensorflow_datasets\core\community\huggingface_wrapper.py", line 31, in from tensorflow_datasets.core import dataset_builder File "C:\Python311\Lib\site-packages\tensorflow_datasets\core\dataset_builder.py", line 34, in from tensorflow_datasets.core import dataset_info File "C:\Python311\Lib\site-packages\tensorflow_datasets\core\dataset_info.py", line 47, in from tensorflow_datasets.core import file_adapters File "C:\Python311\Lib\site-packages\tensorflow_datasets\core\file_adapters.py", line 29, in from array_record.python import array_record_module ImportError: cannot import name 'array_record_module' from 'array_record.python' (C:\Python311\Lib\site-packages\array_record\python\init__.py)

ID6109 commented 1 year ago

Try referring to this.

jbischof commented 1 year ago

@SammyCoder2023 are you trying to use waymo metrics? You should not have to install waymo open dataset to use KerasCV

SammyCoder2023 commented 1 year ago

@ID6109 : Thanks for the information.

Hi @jbischof ,

I'm just exploring, and came across an example like below. Was trying to execute this and for the same installed various dependencies, but is stuck at the point where I'm getting the above said errors, tried multiple things still failing. Will appreciate any support, thank you :

import tensorflow as tf import keras_cv

Download the stable diffusion model from keras_cv

model = keras_cv.models.StableDiffusion(img_width=512, img_height=512)

Save the model to disk

model_path = 'stable_diffusion' model.save(model_path)

Load the saved model

loaded_model = tf.keras.models.load_model(model_path)

Test the loaded model by generating an image from random noise

noise = tf.random.normal([1, 512, 512, 3]) generated_image = loaded_model(noise)

LukeWood commented 1 year ago

Closing as it has been 3~ weeks and we don't have a consensus on the offending code!

If you are receiving these issues when installing from:

pip install git+https://github.com/keras-team/keras-cv

then feel free to re-open!