mathAI icon indicating copy to clipboard operation
mathAI copied to clipboard

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

Open jakob1519 opened this issue 3 years ago • 2 comments

环境都已经建好

因为没有您说的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)

jakob1519 avatar May 09 '22 13:05 jakob1519

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

Roujack avatar May 10 '22 02:05 Roujack

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

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

jakob1519 avatar May 11 '22 10:05 jakob1519