Getting following error when testing the trained python model - python

Please help me through this..
Traceback (most recent call last):
File "object_detection\legacy\train.py", line 186, in
tf.app.run()
File "C:\Users\Administrator\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\platform\app.py", line 40, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File "C:\Users\Administrator\AppData\Roaming\Python\Python37\site-packages\absl\app.py", line 303, in run
_run_main(main, args)
File "C:\Users\Administrator\AppData\Roaming\Python\Python37\site-packages\absl\app.py", line 251, in _run_main
sys.exit(main(argv))
File "C:\Users\Administrator\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\util\deprecation.py", line 324, in new_func
return func(*args, **kwargs)
File "object_detection\legacy\train.py", line 110, in main
overwrite=True)
File "C:\Users\Administrator\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\lib\io\file_io.py", line 469, in copy
copy_v2(oldpath, newpath, overwrite)
File "C:\Users\Administrator\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\lib\io\file_io.py", line 486, in copy_v2
compat.as_bytes(src), compat.as_bytes(dst), overwrite)
tensorflow.python.framework.errors_impl.NotFoundError: NewRandomAccessFile failed to Create/Open: : The system cannot find the path specified.
; No such process

Related

Error with zipfile when installing tensorflow using wheel

Error : ERROR: Exception: Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/pip/_internal/cli/base_command.py", line 189, in _main status = self.run(options, args) File "/usr/local/lib/python3.6/dist-packages/pip/_internal/cli/req_command.py", line 178, in wrapper return func(self, options, args) File "/usr/local/lib/python3.6/dist-packages/pip/_internal/commands/install.py", line 400, in run pycompile=options.compile, File "/usr/local/lib/python3.6/dist-packages/pip/_internal/req/init.py", line 88, in install_given_reqs pycompile=pycompile, File "/usr/local/lib/python3.6/dist-packages/pip/_internal/req/req_install.py", line 796, in install requested=self.user_supplied, File "/usr/local/lib/python3.6/dist-packages/pip/_internal/operations/install/wheel.py", line 827, in install_wheel requested=requested, File "/usr/local/lib/python3.6/dist-packages/pip/_internal/operations/install/wheel.py", line 662, in _install_wheel file.save() File "/usr/local/lib/python3.6/dist-packages/pip/_internal/operations/install/wheel.py", line 427, in save with self._zip_file.open(zipinfo) as f: File "/usr/lib/python3.6/zipfile.py", line 1510, in open raise BadZipFile("Bad magic number for file header") zipfile.BadZipFile: Bad magic number for file header
Downloaded Python wheel tensorflow-2.4.1-cp36-cp36-linux_aarch64.whl from https://github.com/Qengineering/TensorFlow-Raspberry-Pi_64-bit

KeyError when installing tensorflow

I tried installing tensorflow but I got this KeyError:
>py -3.7-64 -m pip install tensorflow
Collecting tensorflow
Downloading tensorflow-2.4.1-cp37-cp37m-win_amd64.whl (370.7 MB)
|██ | 20.2 MB 3.3 MB/s eta 0:01:47ERROR: Exception:
Traceback (most recent call last):
File "C:\...\Python37\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 171, in _merge_into_criterion
crit = self.state.criteria[name]
KeyError: 'tensorflow'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\...\Python37\lib\site-packages\pip\_vendor\urllib3\response.py", line 438, in _error_catcher
yield
File "C:\...\Python37\lib\site-packages\pip\_vendor\urllib3\response.py", line 519, in read
data = self._fp.read(amt) if not fp_closed else b""
File "C:\...\Python37\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 62, in read
data = self.__fp.read(amt)
File "C:\...\Python37\lib\http\client.py", line 461, in read
n = self.readinto(b)
File "C:\...\Python37\lib\http\client.py", line 505, in readinto
n = self.fp.readinto(b)
File "C:\...\Python37\lib\socket.py", line 589, in readinto
return self._sock.recv_into(b)
File "C:\...\Python37\lib\ssl.py", line 1071, in recv_into
return self.read(nbytes, buffer)
File "C:\...\Python37\lib\ssl.py", line 929, in read
return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\...\Python37\lib\site-packages\pip\_internal\cli\base_command.py", line 189, in _main
status = self.run(options, args)
File "C:\...\Python37\lib\site-packages\pip\_internal\cli\req_command.py", line 178, in wrapper
return func(self, options, args)
File "C:\...\Python37\lib\site-packages\pip\_internal\commands\install.py", line 317, in run
reqs, check_supported_wheels=not options.target_dir
File "C:\...\Python37\lib\site-packages\pip\_internal\resolution\resolvelib\resolver.py", line 122, in resolve
requirements, max_rounds=try_to_avoid_resolution_too_deep,
File "C:\...\Python37\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 453, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File "C:\...\Python37\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 318, in resolve
name, crit = self._merge_into_criterion(r, parent=None)
File "C:\...\Python37\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 173, in _merge_into_criterion
crit = Criterion.from_requirement(self._p, requirement, parent)
File "C:\...\Python37\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 82, in from_requirement
if not cands:
File "C:\...\Python37\lib\site-packages\pip\_vendor\resolvelib\structs.py", line 124, in __bool__
return bool(self._sequence)
File "C:\...\Python37\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 143, in __bool__
return any(self)
File "C:\...\Python37\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 38, in _iter_built
candidate = func()
File "C:\...\Python37\lib\site-packages\pip\_internal\resolution\resolvelib\factory.py", line 169, in _make_candidate_from_link
name=name, version=version,
File "C:\...\Python37\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 306, in __init__
version=version,
File "C:\...\Python37\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 144, in __init__
self.dist = self._prepare()
File "C:\...\Python37\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 226, in _prepare
dist = self._prepare_distribution()
File "C:\...\Python37\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 312, in _prepare_distribution
self._ireq, parallel_builds=True,
File "C:\...\Python37\lib\site-packages\pip\_internal\operations\prepare.py", line 457, in prepare_linked_requirement
return self._prepare_linked_requirement(req, parallel_builds)
File "C:\...\Python37\lib\site-packages\pip\_internal\operations\prepare.py", line 482, in _prepare_linked_requirement
self.download_dir, hashes,
File "C:\...\Python37\lib\site-packages\pip\_internal\operations\prepare.py", line 234, in unpack_url
hashes=hashes,
File "C:\...\Python37\lib\site-packages\pip\_internal\operations\prepare.py", line 108, in get_http_url
from_path, content_type = download(link, temp_dir.path)
File "C:\...\Python37\lib\site-packages\pip\_internal\network\download.py", line 163, in __call__
for chunk in chunks:
File "C:\...\Python37\lib\site-packages\pip\_internal\cli\progress_bars.py", line 159, in iter
for x in it:
File "C:\...\Python37\lib\site-packages\pip\_internal\network\utils.py", line 88, in response_chunks
decode_content=False,
File "C:\...\Python37\lib\site-packages\pip\_vendor\urllib3\response.py", line 576, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "C:\...\Python37\lib\site-packages\pip\_vendor\urllib3\response.py", line 541, in read
raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
File "C:\...\Python37\lib\contextlib.py", line 130, in __exit__
self.gen.throw(type, value, traceback)
File "C:\...\Python37\lib\site-packages\pip\_vendor\urllib3\response.py", line 443, in _error_catcher
raise ReadTimeoutError(self._pool, None, "Read timed out.")
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
Then I tried installing it using a virtual environment (venv), and the progress bar went a bit further this time, but it still threw pretty much the same error.
Any ideas how to fix this?
Thanks.
Just use --default-timeout=100 parameter with the install. e.g
py -3.7-64 -m pip install --default-timeout=100 tensorflow
I hope, this will help you.
I've tried a lot of methods but useless. Finally I have to reinstalled my python and it works.

Weird issue with running pretrained model with tensorflow

(tensorflow) C:\tensorflow\workspace\training_demo>python model_main_tf2.py --model_dir=C:/tensorflow/workspace/models/my_ssd_resnet50_v1_fpn --pipeline_config_path=C:/tensorflow/workspace/models/my_ssd_resnet50_v1_fpn/pipeline.config
From C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\object_detection\model_lib_v2.py:522: StrategyBase.experimental_distribute_datasets_from_function (from tensorflow.python.distribute.distribute_lib) is deprecated and will be removed in a future version.
Instructions for updating:
rename to distribute_datasets_from_function
Traceback (most recent call last):
File "model_main_tf2.py", line 113, in <module>
tf.compat.v1.app.run()
File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\platform\app.py", line 40, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\absl\app.py", line 300, in run
_run_main(main, args)
File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\absl\app.py", line 251, in _run_main
sys.exit(main(argv))
File "model_main_tf2.py", line 104, in main
model_lib_v2.train_loop(
File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\object_detection\model_lib_v2.py", line 522, in train_loop
train_input = strategy.experimental_distribute_datasets_from_function(
File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\util\deprecation.py", line 340, in new_func
return func(*args, **kwargs)
File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\distribute\distribute_lib.py", line 1143, in experimental_distribute_datasets_from_function
return self.distribute_datasets_from_function(dataset_fn, options)
File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\distribute\distribute_lib.py", line 1134, in distribute_datasets_from_function
return self._extended._distribute_datasets_from_function( # pylint: disable=protected-access
File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\distribute\mirrored_strategy.py", line 545, in _distribute_datasets_from_function
return input_lib.get_distributed_datasets_from_function(
File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\distribute\input_lib.py", line 161, in get_distributed_datasets_from_function
return DistributedDatasetsFromFunction(dataset_fn, input_workers,
File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\distribute\input_lib.py", line 1272, in __init__
_create_datasets_from_function_with_input_context(
File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\distribute\input_lib.py", line 1936, in _create_datasets_from_function_with_input_context
dataset = dataset_fn(ctx)
File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\object_detection\model_lib_v2.py", line 513, in train_dataset_fn
train_input = inputs.train_input(
File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\object_detection\inputs.py", line 870, in train_input
dataset = INPUT_BUILDER_UTIL_MAP['dataset_build'](
File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\object_detection\builders\dataset_builder.py", line 195, in build
decoder = decoder_builder.build(input_reader_config)
File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\object_detection\builders\decoder_builder.py", line 52, in build
decoder = tf_example_decoder.TfExampleDecoder(
File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\object_detection\data_decoders\tf_example_decoder.py", line 391, in __init__
_ClassTensorHandler(
File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\object_detection\data_decoders\tf_example_decoder.py", line 88, in __init__
name_to_id = label_map_util.get_label_map_dict(
File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\object_detection\utils\label_map_util.py", line 201, in get_label_map_dict
label_map = load_labelmap(label_map_path_or_proto)
File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\object_detection\utils\label_map_util.py", line 168, in load_labelmap
label_map_string = fid.read()
File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 117, in read
self._preread_check()
File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 79, in _preread_check
self._read_buf = _pywrap_file_io.BufferedInputStream(
tensorflow.python.framework.errors_impl.InvalidArgumentError: NewRandomAccessFile failed to Create/Open: C: ensorflow\workspacennotations\labelmap.pbtxt : The filename, directory name, or volume label syntax is incorrect.
; no protocol option
So im getting this weird issue where its changing the path of the file its looking for on its own.
C: ensorflow\workspacennotations\labelmap.pbtxt
should be
C:tensorflow\workspace\annotations\labelmap.pbtxt
Been stuck on this issue for quite a while now, tried several things including changing to forward slashes and stuff. Any idea what to do here? I followed this guide: https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html
\t in your path automatically replaces by tab. For prevent this on Windows, you need use double backslash (\\) as path delimiter: C:\\tensorflow\\...

facing coding error when want to train the model in google colab

the code I used was:
!python3 object_detection/model_main.py \
--pipeline_config_path=/gdrive/My\ Drive/object_detection/models/research/object_detection/samples/configs/ssd_mobilenet_v2_coco.config \
--model_dir=training/
and the errors I faced were:
**Traceback (most recent call last):
File "object_detection/model_main.py", line 109, in <module>
tf.app.run()
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/platform/app.py", line 40, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File "/usr/local/lib/python3.6/dist-packages/absl/app.py", line 299, in run
_run_main(main, args)
File "/usr/local/lib/python3.6/dist-packages/absl/app.py", line 250, in _run_main
sys.exit(main(argv))
File "object_detection/model_main.py", line 71, in main
FLAGS.sample_1_of_n_eval_on_train_examples))
File "/content/drive/My Drive/object_detection/models/research/object_detection/model_lib.py", line 617, in create_estimator_and_inputs
pipeline_config_path, config_override=config_override)
File "/content/drive/My Drive/object_detection/models/research/object_detection/utils/config_util.py", line 103, in get_configs_from_pipeline_file
proto_str = f.read()
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/lib/io/file_io.py", line 122, in read
self._preread_check()
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/lib/io/file_io.py", line 84, in _preread_check
compat.as_bytes(self.__name), 1024 * 512)
tensorflow.python.framework.errors_impl.NotFoundError:/gdrive/My Drive/object_detection/models/research/object_detection/samples/configs/ssd_mobilenet_v2_coco.config; No such file or directory
I have checked so many time that the path is already correct and connected, but don't know why still occur this error, please help!

Does tf_debug truly support slim?

I have written the following code:
tf.contrib.slim.learning.train(
...
...
session_wrapper=tensorflow.python.debug.LocalCLIDebugWrapperSession,
...)
While running the code, it reported:
......
......
2018-02-14 01:03:25.229477: I tensorflow/core/debug/debug_graph_utils.cc:229] For debugging, tfdbg is changing the parallel_iterations attribute of the Enter/RefEnter node "lstm/lstm_1/while/Enter_2" on device "/job:localhost/replica:0/task:0/device:CPU:0" from 32 to 1. (This does not affect subsequent non-debug runs.)
Traceback (most recent call last):
File "train_getimageid_ngch.py", line 147, in <module>
tf.app.run()
File "/home/ngaimanchow/tensorflow_virtualenv/local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "train_getimageid_ngch.py", line 143, in main
saver=saver)
File "/home/ngaimanchow/tensorflow_virtualenv/local/lib/python2.7/site-packages/tensorflow/contrib/slim/python/slim/learning.py", line 775, in train
sv.stop(threads, close_summary_writer=True)
File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__
self.gen.throw(type, value, traceback)
File "/home/ngaimanchow/tensorflow_virtualenv/local/lib/python2.7/site-packages/tensorflow/python/training/supervisor.py", line 964, in managed_session
self.stop(close_summary_writer=close_summary_writer)
File "/home/ngaimanchow/tensorflow_virtualenv/local/lib/python2.7/site-packages/tensorflow/python/training/supervisor.py", line 792, in stop
stop_grace_period_secs=self._stop_grace_secs)
File "/home/ngaimanchow/tensorflow_virtualenv/local/lib/python2.7/site-packages/tensorflow/python/training/coordinator.py", line 389, in join
six.reraise(*self._exc_info_to_raise)
File "/home/ngaimanchow/tensorflow_virtualenv/local/lib/python2.7/site-packages/tensorflow/python/training/coordinator.py", line 296, in stop_on_exception
yield
File "/home/ngaimanchow/tensorflow_virtualenv/local/lib/python2.7/site-packages/tensorflow/python/training/coordinator.py", line 494, in run
self.run_loop()
File "/home/ngaimanchow/tensorflow_virtualenv/local/lib/python2.7/site-packages/tensorflow/python/training/supervisor.py", line 1068, in run_loop
global_step=self._sv.global_step)
File "/home/ngaimanchow/tensorflow_virtualenv/local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1549, in save
global_step = training_util.global_step(sess, global_step)
File "/home/ngaimanchow/tensorflow_virtualenv/local/lib/python2.7/site-packages/tensorflow/python/training/training_util.py", line 67, in global_step
return int(sess.run(global_step_tensor))
File "/home/ngaimanchow/tensorflow_virtualenv/local/lib/python2.7/site-packages/tensorflow/python/debug/wrappers/framework.py", line 543, in run
run_end_resp = self.on_run_end(run_end_req)
File "/home/ngaimanchow/tensorflow_virtualenv/local/lib/python2.7/site-packages/tensorflow/python/debug/wrappers/local_cli_wrapper.py", line 321, in on_run_end
self._dump_root, partition_graphs=partition_graphs)
File "/home/ngaimanchow/tensorflow_virtualenv/local/lib/python2.7/site-packages/tensorflow/python/debug/lib/debug_data.py", line 495, in __init__
self._load_all_device_dumps(partition_graphs, validate)
File "/home/ngaimanchow/tensorflow_virtualenv/local/lib/python2.7/site-packages/tensorflow/python/debug/lib/debug_data.py", line 517, in _load_all_device_dumps
self._load_partition_graphs(partition_graphs, validate)
File "/home/ngaimanchow/tensorflow_virtualenv/local/lib/python2.7/site-packages/tensorflow/python/debug/lib/debug_data.py", line 798, in _load_partition_graphs
self._validate_dump_with_graphs(debug_graph.device_name)
File "/home/ngaimanchow/tensorflow_virtualenv/local/lib/python2.7/site-packages/tensorflow/python/debug/lib/debug_data.py", line 843, in _validate_dump_with_graphs
"device %s." % (datum.node_name, device_name))
ValueError: Node name 'TFRecordReaderV2' is not found in partition graphs of device /job:localhost/replica:0/task:0/device:CPU:0.
Even it can start the tf debugger, when tried to print the value of a tensor, i.e. the pt command, it reported the error:
Error occured during handling of command: "print_tensor"
exceptions.KeyError /device:CPU:0
Is it possible for tf_debug to truly support slim? How can it be worked out? If not, is there any other way to debug or print the values of tensors when using tf.contrib.slim.learning.train?

Categories

Resources