Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • ketos ketos
  • Project information
    • Project information
    • Activity
    • Labels
    • Planning hierarchy
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 27
    • Issues 27
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • public_projects
  • ketosketos
  • Issues
  • #150

Closed
Open
Created Jan 09, 2022 by Liz Ferguson@lizferguson

CNN Network Recommendations

Hi again, I switched gears from the ResNet network to give the CNN a run and believe I have something wrong in the arguments. I'm specifically thinking it has to do with the output_transfrom_func argument for the BatchGenerator - while there was an examples for the ResNet, I couldn't find a comparable CNN transform_batch and so went with None (As it seemed to be the only other option).

The error I'm getting is when running the loop: cnn.train_loop(n_epochs=30, verbose=True, log_csv=True) Traceback (most recent call last): File "C:\Users\eferg.conda\envs\ketos_env\lib\site-packages\IPython\core\interactiveshell.py", line 3444, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 1, in cnn.train_loop(n_epochs=30, verbose=True, log_csv=True) File "C:\Users\eferg.conda\envs\ketos_env\lib\site-packages\ketos\neural_networks\dev_utils\nn_interface.py", line 1296, in train_loop self._train_step(train_X, train_Y) File "C:\Users\eferg.conda\envs\ketos_env\lib\site-packages\tensorflow\python\eager\def_function.py", line 780, in call result = self._call(*args, **kwds) File "C:\Users\eferg.conda\envs\ketos_env\lib\site-packages\tensorflow\python\eager\def_function.py", line 823, in _call self._initialize(args, kwds, add_initializers_to=initializers) File "C:\Users\eferg.conda\envs\ketos_env\lib\site-packages\tensorflow\python\eager\def_function.py", line 697, in _initialize *args, **kwds)) File "C:\Users\eferg.conda\envs\ketos_env\lib\site-packages\tensorflow\python\eager\function.py", line 2855, in _get_concrete_function_internal_garbage_collected graph_function, _, _ = self._maybe_define_function(args, kwargs) File "C:\Users\eferg.conda\envs\ketos_env\lib\site-packages\tensorflow\python\eager\function.py", line 3171, in _maybe_define_function *args, **kwargs) File "C:\Users\eferg.conda\envs\ketos_env\lib\site-packages\tensorflow\python\eager\function.py", line 2614, in canonicalize_function_inputs inputs = _convert_numpy_inputs(inputs) File "C:\Users\eferg.conda\envs\ketos_env\lib\site-packages\tensorflow\python\eager\function.py", line 2663, in _convert_numpy_inputs flat_inputs[index] = constant_op.constant(a) File "C:\Users\eferg.conda\envs\ketos_env\lib\site-packages\tensorflow\python\framework\constant_op.py", line 264, in constant allow_broadcast=True) File "C:\Users\eferg.conda\envs\ketos_env\lib\site-packages\tensorflow\python\framework\constant_op.py", line 275, in _constant_impl return _constant_eager_impl(ctx, value, dtype, shape, verify_shape) File "C:\Users\eferg.conda\envs\ketos_env\lib\site-packages\tensorflow\python\framework\constant_op.py", line 300, in _constant_eager_impl t = convert_to_eager_tensor(value, ctx, dtype) File "C:\Users\eferg.conda\envs\ketos_env\lib\site-packages\tensorflow\python\framework\constant_op.py", line 98, in convert_to_eager_tensor return ops.EagerTensor(value, ctx.device_name, dtype) ValueError: Failed to convert a NumPy array to a Tensor (Unsupported numpy data type).

And here is the code that I am attempting to use. I saw Shaula's issue which seemed similar to some of the ones I have had but couldn't work out if there was a solution that might fit this problem (or my other ResNet issue)🚯

import tensorflow as tf from ketos.neural_networks.cnn import CNNInterface from ketos.neural_networks.cnn import default_cnn_recipe

train_generator_CNN = BatchGenerator(batch_size=128, data_table=train_data, annot_in_data_table=True, output_transform_func=None, shuffle=True, refresh_on_epoch_end=True)

val_generator_CNN = BatchGenerator(batch_size=128, data_table=test_data, annot_in_data_table=True, output_transform_func=None, shuffle=True, refresh_on_epoch_end=False)

default_cnn_recipe cnn = CNNInterface._build_from_recipe(default_cnn_recipe) cnn.train_generator = train_generator_CNN cnn.val_generator = val_generator_CNN cnn.checkpoint_dir = "CNNCheckpoints" cnn.log_dir = "CNNLogs"

cnn.train_loop(n_epochs=30, verbose=True, log_csv=True)

Thanks for any guidance!! Again, apologies for being a neural network novice!

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking