I am following this github(https://github.com/intel/lpot/tree/master/examples/tensorflow/object_detection) for lpot and in the 5th step for downloading the dataset I am getting the below error.Unable to proceed.
HEAD is now at 7a9934df Merged commit includes the following changes: 184048729 by Zhichao Lu:
Traceback (most recent call last):
File "./object_detection/dataset_tools/create_coco_tf_record.py", line 46, in <module>
flags = tf.app.flags
AttributeError: module 'tensorflow' has no attribute 'app'
mv: cannot stat '/root/lpot/examples/tensorflow/object_detection/data/coco_testdev.record*': No such file or directory
mv: cannot stat '/root/lpot/examples/tensorflow/object_detection/data/coco_train.record*': No such file or directory
mv: cannot stat '/root/lpot/examples/tensorflow/object_detection/data/coco_val.record*': No such file or directory
Thanks in advance.
If it is tensorflow 2.0 or higher version then minor change in create_coco_tf_record.py code will resolve your issue.Replace import tensorflow as tf with import tensorflow.compat.v1 as tf
Regards,
Janani Chandran
Related
I have been trying to program a voice recorder but it gives me an error that I have never seen.
This is pythmy code:
import sounddevice as sd
from scipy.io.wavfile import write
def record(name , duration):
freq = 48000
duration = 10
recording = sd.rec(int(duration * freq), samplerate=freq ,channels=2)
sd.wait()
write(".\\audio\\wav\\MyRecording.wav", freq, recording)
print(recording)
record("hi" , 5)
Tbtw the reason that I print recording is to see how it exactly record voice
and This is the error :
Traceback (most recent call last):
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38-32\lib\site-packages\numpy\core\__init__.py", line 22, in <module>
from . import multiarray
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38-32\lib\site-packages\numpy\core\multiarray.py", line 12, in <module>
from . import overrides
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38-32\lib\site-packages\numpy\core\overrides.py", line 7, in <module>
from numpy.core._multiarray_umath import (
ImportError: DLL load failed while importing _multiarray_umath: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\school\helli3\9th\پژوهشی کامپیوتر\project\Voisy\Voisy\src\recorder.py", line 2, in <module>
from scipy.io.wavfile import write
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38-32\lib\site-packages\scipy\__init__.py", line 67, in <module>
from numpy import show_config as show_numpy_config
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38-32\lib\site-packages\numpy\__init__.py", line 145, in <module>
from . import core
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38-32\lib\site-packages\numpy\core\__init__.py", line 48, in <module>
raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.8 from "C:\Users\ASUS\AppData\Local\Programs\Python\Python38-32\python.exe"
* The NumPy version is: "1.20.3"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: DLL load failed while importing _multiarray_umath: The specified module could not be found.
how can I fix this error? (I have installed scipy and sounddevice liabrary)
I am trying to run the following lines:
import tensorflow as tf
physical_devices = tf.config.list_physical_devices("GPU")
for i in range(len(physical_devices)):
tf.config.experimental.set_memory_growth(physical_devices[i], True)
I am trying to run this lines too:
import tensorflow as tf
physical_devices = tf.test.gpu_device_name("GPU")
for i in range(len(physical_devices)):
tf.config.experimental.set_memory_growth(physical_devices[i], True)
But the first method errors out like this:
Traceback (most recent call last):
File "main_train.py", line 4, in <module>
physical_devices = tf.config.list_physical_devices("GPU")
AttributeError: module 'tensorflow' has no attribute 'config'
And the second method errors out like this:
Traceback (most recent call last):
File "main_train.py", line 5, in <module>
for i in range(len(tf.test.gpu_device_name("GPU"))):
AttributeError: module 'tensorflow' has no attribute 'test'
I am using Tensorflow 2.4.0 .Any ideas what I'm doing wrong?
If anyone could help that would be great:)
Thank's for every help in advance:)
I read that you already fixed it but since you didn't included it in your post here is the solution everyone else having this error: you need to change some modules from e.g. tf.config.list_physical_devices("GPU") to tf.compat.v1.config.list_physical_devices("GPU"). By adding ".compat.v1" you are ensuring backwards capability. You can use this code snippet for all other modules, that don't work.
according to the tutorial at this link I want to create my custom dataset and use it with tensorflow.
I have installed the tfds command and when I entering tfds new my_dataset command, I will encounter to this error :
tfds new my_dataset
Traceback (most recent call last):
File "/root/anaconda3/envs/simclr/bin/tfds", line 5, in <module>
from tensorflow_datasets.scripts.cli.main import launch_cli
File "/root/anaconda3/envs/simclr/lib/python3.7/site-packages/tensorflow_datasets/scripts/cli/main.py", line 39, in <module>
from tensorflow_datasets.scripts.cli import build
File "/root/anaconda3/envs/simclr/lib/python3.7/site-packages/tensorflow_datasets/scripts/cli/build.py", line 275, in <module>
def _search_script_path(ds_to_build: str) -> Optional[tfds.core.ReadOnlyPath]:
AttributeError: module 'tensorflow_datasets.core' has no attribute 'ReadOnlyPath'
I changed the access level to rwx, and again the error raise.
I don't know how to solve it.
this problem solved in tensorflow V2. so use tensorflow V2 or higher versions.
I am using the inception model in https://github.com/Wnaner/tensorflow_models_nets.git, when I tried to run the file "inception_v3_train_val.py", an error occur:
Traceback (most recent call last):
File "inception_v3_train_val.py", line 8, in <module>
import slim.nets.inception_v3 as inception_v3
File "/Users/myname/Desktop/tensorflow_models_learning/slim/nets/inception_v3.py", line 23, in <module>
from nets import inception_utils
ImportError: cannot import name 'inception_utils' from 'nets' (/Users/myname/miniconda3/lib/python3.7/site-packages/nets/__init__.py)
but when i check the nets folder, it does have a inception_utils.py, now i don't know how to solve this problem, hope somebody can help. Thanks very much.
I've followed the instructions in Detectron and I've configured it several times: the code compiles as it should. When it comes to run the code, I get this error:
Traceback (most recent call last):
File "tools/train_net_step.py", line 21, in <module>
import nn as mynn
File "/home/federico/PycharmProjects/Detectron.pytorch/lib/nn/__init__.py", line 2, in <module>
from .parallel import DataParallel
File "/home/federico/PycharmProjects/Detectron.pytorch/lib/nn/parallel/__init__.py", line 3, in <module>
from .data_parallel import DataParallel, data_parallel
File "/home/federico/PycharmProjects/Detectron.pytorch/lib/nn/parallel/data_parallel.py", line 4, in <module>
from .scatter_gather import scatter_kwargs, gather
File "/home/federico/PycharmProjects/Detectron.pytorch/lib/nn/parallel/scatter_gather.py", line 8, in <module>
from torch.utils.data.dataloader import numpy_type_map
ImportError: cannot import name 'numpy_type_map'
I've also tried to google it many times, but I can't find a way to solve it. What can I do? I'm using PyTorch 0.4.1 and pytorch nightly 1.0.0-dev.
EDIT: Thanks to sancelot, I managed to solve that error (PyTorch 0.4.0 did the thing). Anyway, now I've got another error:
Traceback (most recent call last):
File "tools/train_net_step.py", line 27, in <module>
from modeling.model_builder import Generalized_RCNN
File "/home/federico/PycharmProjects/Detectron.pytorch/lib/modeling/model_builder.py", line 11, in <module>
from model.roi_pooling.functions.roi_pool import RoIPoolFunction
File "/home/federico/PycharmProjects/Detectron.pytorch/lib/model/roi_pooling/functions/roi_pool.py", line 3, in <module>
from .._ext import roi_pooling
File "/home/federico/PycharmProjects/Detectron.pytorch/lib/model/roi_pooling/_ext/roi_pooling/__init__.py", line 3, in <module>
from ._roi_pooling import lib as _lib, ffi as _ffi
ImportError: /home/federico/PycharmProjects/Detectron.pytorch/lib/model/roi_pooling/_ext/roi_pooling/_roi_pooling.so: undefined symbol: PyInt_FromLong
What I can't get this time is: is this an error given by an external library? I'm using an anaconda environment previously made by my professor, who has used it for Detectron... so I can't guess why I get this.
Yeah, these are due to Pytorch version mismatch. Solution depends on what extent you are willing to go, sometimes if you are okay with hacking and just getting it running, then just copy paste the numpy_type_map from older versions:
numpy_type_map = {
'float64': torch.DoubleTensor,
'float32': torch.FloatTensor,
'float16': torch.HalfTensor,
'int64': torch.LongTensor,
'int32': torch.IntTensor,
'int16': torch.ShortTensor,
'int8': torch.CharTensor,
'uint8': torch.ByteTensor,
}
Or, up to version 1.1.0, you can try replacing the import statement,
from:
from torch.utils.data.dataloader import numpy_type_map
to:
from torch.utils.data._utils.collate import numpy_type_map
N.b. will still break in more recent versions. Again, this is a hacky quick-fix solution.
I suppose there is a version mismatch between detectron and the needed pytorch release you are using.
if you look at latest pytorch source code, there is no numpy_type_map component.
https://github.com/pytorch/pytorch/blob/master/torch/utils/data/dataloader.py