Basic_CNNs_TensorFlow2 icon indicating copy to clipboard operation
Basic_CNNs_TensorFlow2 copied to clipboard

I put picture in dataset folder,but have some problems,please help me!

Open miki1638879381 opened this issue 2 years ago • 0 comments

2023-02-21 19:53:25.950975: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. 2023-02-21 19:53:25.953773: I tensorflow/core/common_runtime/process_util.cc:146] Creating new thread pool with default inter op setting: 2. Tune using inter_op_parallelism_threads for best performance. Tensor("args_0:0", shape=(), dtype=float32) Traceback (most recent call last): File "k:/resnet/TensorFlow2.0_ResNet-master/train.py", line 33, in train_dataset, valid_dataset, test_dataset, train_count, valid_count, test_count = generate_datasets() File "k:\resnet\TensorFlow2.0_ResNet-master\prepare_data.py", line 49, in generate_datasets train_dataset, train_count = get_dataset(dataset_root_dir=config.train_dir) File "k:\resnet\TensorFlow2.0_ResNet-master\prepare_data.py", line 40, in get_dataset image_dataset = tf.data.Dataset.from_tensor_slices(all_image_path).map(load_and_preprocess_image) File "G:\study\anaconda\envs\supercjq_copy1128\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py", line 2048, in map return MapDataset(self, map_func, preserve_cardinality=True, name=name) File "G:\study\anaconda\envs\supercjq_copy1128\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py", line 5243, in init self._map_func = structured_function.StructuredFunctionWrapper( File "G:\study\anaconda\envs\supercjq_copy1128\lib\site-packages\tensorflow\python\data\ops\structured_function.py", line 271, in init self._function = fn_factory() File "G:\study\anaconda\envs\supercjq_copy1128\lib\site-packages\tensorflow\python\eager\function.py", line 2567, in get_concrete_function graph_function = self._get_concrete_function_garbage_collected( File "G:\study\anaconda\envs\supercjq_copy1128\lib\site-packages\tensorflow\python\eager\function.py", line 2533, in _get_concrete_function_garbage_collected graph_function, _ = self.maybe_define_function(args, kwargs) File "G:\study\anaconda\envs\supercjq_copy1128\lib\site-packages\tensorflow\python\eager\function.py", line 2711, in maybe_define_function graph_function = self.create_graph_function(args, kwargs) File "G:\study\anaconda\envs\supercjq_copy1128\lib\site-packages\tensorflow\python\eager\function.py", line 2627, in create_graph_function func_graph_module.func_graph_from_py_func( File "G:\study\anaconda\envs\supercjq_copy1128\lib\site-packages\tensorflow\python\framework\func_graph.py", line 1141, in func_graph_from_py_func func_outputs = python_func(*func_args, **func_kwargs) File "G:\study\anaconda\envs\supercjq_copy1128\lib\site-packages\tensorflow\python\data\ops\structured_function.py", line 248, in wrapped_fn ret = wrapper_helper(*args) File "G:\study\anaconda\envs\supercjq_copy1128\lib\site-packages\tensorflow\python\data\ops\structured_function.py", line 177, in wrapper_helper ret = autograph.tf_convert(self.func, ag_ctx)(*nested_args) File "G:\study\anaconda\envs\supercjq_copy1128\lib\site-packages\tensorflow\python\autograph\impl\api.py", line 692, in wrapper raise e.ag_error_metadata.to_exception(e) File "G:\study\anaconda\envs\supercjq_copy1128\lib\site-packages\tensorflow\python\autograph\impl\api.py", line 689, in wrapper return converted_call(f, args, kwargs, options=options) File "G:\study\anaconda\envs\supercjq_copy1128\lib\site-packages\tensorflow\python\autograph\impl\api.py", line 439, in converted_call result = converted_f(*effective_args, **kwargs) File "C:\Users\16388\AppData\Local\Temp_autograph_generated_filen3u7t458.py", line 11, in tf__load_and_preprocess_image img_raw = ag.converted_call(ag.ld(tf).io.read_file, (ag.ld(img_path),), None, fscope) File "G:\study\anaconda\envs\supercjq_copy1128\lib\site-packages\tensorflow\python\autograph\impl\api.py", line 377, in converted_call return _call_unconverted(f, args, kwargs, options) File "G:\study\anaconda\envs\supercjq_copy1128\lib\site-packages\tensorflow\python\autograph\impl\api.py", line 459, in _call_unconverted return f(*args) File "G:\study\anaconda\envs\supercjq_copy1128\lib\site-packages\tensorflow\python\ops\io_ops.py", line 133, in read_file return gen_io_ops.read_file(filename, name) File "G:\study\anaconda\envs\supercjq_copy1128\lib\site-packages\tensorflow\python\ops\gen_io_ops.py", line 570, in read_file _, _, _op, _outputs = _op_def_library._apply_op_helper( File "G:\study\anaconda\envs\supercjq_copy1128\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 779, in _apply_op_helper _ExtractInputsAndAttrs(op_type_name, op_def, allowed_list_attr_map, File "G:\study\anaconda\envs\supercjq_copy1128\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 579, in _ExtractInputsAndAttrs raise TypeError(f"{prefix} expected type of " TypeError: in user code:

File "k:\resnet\TensorFlow2.0_ResNet-master\prepare_data.py", line 11, in load_and_preprocess_image  *
    img_raw = tf.io.read_file(img_path)

TypeError: Input 'filename' of 'ReadFile' Op has type float32 that does not match expected type of string.

miki1638879381 avatar Feb 21 '23 11:02 miki1638879381