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

TypeError: data must be either a numpy array or pandas DataFrame if pandas is installed; got dict #23

Open
jakob1519 opened this issue May 9, 2022 · 2 comments

Comments

@jakob1519
Copy link

jakob1519 commented May 9, 2022

环境都已经建好

因为没有您说的opencv版本号
所以用pip install opencv-python==3.4.17.63下载
但在run main.py时出现以下的错误

TypeError: data must be either a numpy array or pandas DataFrame if pandas is installed; got dict

错误是发生在main.py的
for i,p in enumerate(predictions):

estimator.py的
features, input_hooks = self._get_features_from_input_fn(input_fn, ModeKeys.PREDICT)

@Roujack
Copy link
Owner

Roujack commented May 10, 2022

你能把错误贴完全一点吗?感觉你是不是tensorflow版本没有安装对啊?

@jakob1519
Copy link
Author

不好意思 这是完整的错误讯息

2022-05-11 18:02:31.429282: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
2022-05-11 18:02:31.451464: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a
GPU set up on your machine.
INFO:tensorflow:Using default config.
INFO:tensorflow:Using config: {'_model_dir': './my_cnn_model_config5', '_tf_random_seed': None, '_save_summary_steps': 100, '_save_checkpoints_steps': None, '_save_checkpoints_secs': 600, '_session_config': allow_soft_placement: true
graph_options {
rewrite_options {
meta_optimizer_iterations: ONE
}
}
, '_keep_checkpoint_max': 5, '_keep_checkpoint_every_n_hours': 10000, '_log_step_count_steps': 100, '_train_distribute': None, '_device_fn': None, '_protocol': None, '_eval_distribute': None, '_experimental_distribute': None, '_experimental_max_worker_delay_secs': None, '_session_creation_timeout_secs': 7200, '_checkpoint_save_graph_def': True, '_service': None, '_cluster_spec': ClusterSpec({}), '_task_type': 'worker', '_task_id': 0, '_global_id_in_cluster': 0, '_master': '', '_evaluation_master': '', '_is_chief':
True, '_num_ps_replicas': 0, '_num_worker_replicas': 1}
WARNING:tensorflow:From C:\Python\Python39\lib\site-packages\tensorflow\python\util\lazy_loader.py:63: The name tf.estimator.inputs is deprecated. Please use tf.compat.v1.estimator.inputs instead.

WARNING:tensorflow:From c:\mathAI-master\source_code\main.py:47: The name tf.estimator.inputs.pandas_input_fn is deprecated. Please use tf.compat.v1.estimator.inputs.pandas_input_fn instead.

<generator object Estimator.predict at 0x0000013DD80A4EB0>
type(input_fn) : <class 'function'>
input_fn : <function pandas_input_fn..input_fn at 0x0000013DD80A53A0>
ModeKeys.PREDICT : infer
kwargs : {}
Traceback (most recent call last):
File "c:\mathAI-master\source_code\main.py", line 54, in
for i,p in enumerate(predictions):
File "C:\Python\Python39\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py", line 625, in predict
features, input_hooks = self._get_features_from_input_fn(
File "C:\Python\Python39\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py", line 1022, in _get_features_from_input_fn
result = self._call_input_fn(input_fn, mode)
File "C:\Python\Python39\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py", line 1146, in _call_input_fn
return input_fn(**kwargs)
File "C:\Python\Python39\lib\site-packages\tensorflow_estimator\python\estimator\inputs\pandas_io.py", line 132, in input_fn
queue = feeding_functions._enqueue_data( # pylint: disable=protected-access
File "C:\Python\Python39\lib\site-packages\tensorflow_estimator\python\estimator\inputs\queues\feeding_functions.py", line 401, in _enqueue_data
raise TypeError(
TypeError: data must be either a numpy array or pandas DataFrame if pandas is installed; got dict

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