Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tensorflow version, learning part not working #27

Open
B-Seif opened this issue Jun 14, 2024 · 3 comments
Open

Tensorflow version, learning part not working #27

B-Seif opened this issue Jun 14, 2024 · 3 comments

Comments

@B-Seif
Copy link

B-Seif commented Jun 14, 2024

First of all, I would like to congratulate you on this great work. I try to reproduce the results and see how to integrate a new approach into this benchmark. However, not having experience with Tensorflow, I'm having a little trouble debugging the error below.
In fact, I have a problem with Tensorflow learning part of the code. The generation of feautre is going well but the learning part is not working. Below is what I get as an error. I followed all the steps you recommended. I'm using Docker and I have version 2.16 of Tensorflow.

Thanks for your help.

python train_test.py -c config_files/PCPA.yaml 
 Total params: 31,165,953 (118.89 MB)
 Trainable params: 31,165,953 (118.89 MB)
 Non-trainable params: 0 (0.00 B)
### Class weights: negative 0.204 and positive 0.796 ###
lerreur commence par là je crois 
Traceback (most recent call last):
  File "/data/PedestrianActionBenchmark/PedestrianActionBenchmark/train_test.py", line 165, in <module>
    run(config_file=config_file)
  File "/data/PedestrianActionBenchmark/PedestrianActionBenchmark/train_test.py", line 107, in run
    saved_files_path = method_class.train(beh_seq_train, beh_seq_val, **configs['train_opts'],
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/PedestrianActionBenchmark/PedestrianActionBenchmark/action_predict.py", line 759, in train
    history = train_model.fit(x=data_train['data'][0],
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/keras/src/utils/traceback_utils.py", line 123, in error_handler
    raise e.with_traceback(filtered_tb) from None
  File "/usr/local/lib/python3.11/dist-packages/tensorflow/python/data/ops/from_generator_op.py", line 124, in _from_generator
    raise TypeError(f"`output_signature` must contain objects that are "
TypeError: `output_signature` must contain objects that are subclass of `tf.TypeSpec` but found <class 'list'> which is not.
@ykotseruba
Copy link
Owner

ykotseruba commented Jun 22, 2024

Hi, thank you for your interest in our work and for notifying us of this problem.
This issue is caused by the generator in the recent versions of tensorflow. Changing line 2379 in action_predict.py to return tuple(X) fixes it.

@ykotseruba
Copy link
Owner

I'm rerunning some results on the newer version of TF, if they are ok, I'll update the repo.

@B-Seif
Copy link
Author

B-Seif commented Sep 29, 2024

Hi, Thanks for your help.
Could you tell me how to change please?

            _data_rgb = (_data_samples[feature_type], _data_samples['crossing'])
            _data_opt_flow = (_data_samples['optical_flow'], _data_samples['crossing'])

        return {'data_rgb': _data_rgb,
                'ped_id': data['ped_id'],
                'tte': data['tte'],
                'data_opt_flow': _data_opt_flow,
                'data_params_rgb': {'data_types': [feature_type],
                                    'data_sizes': [data_type_sizes_dict[feature_type]]},
                'data_params_opt_flow': {'data_types': ['optical_flow'],
                                         'data_sizes': [data_type_sizes_dict['optical_flow']]},
                'effective_dimension': effective_dimension,
                'count': {'neg_count': neg_count, 'pos_count': pos_count}}

In the meantime, I disabled generation step (in config file I set generator= False) and it works. However, I can't reproduce the results as they are in the paper.
Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants