lighttrack icon indicating copy to clipboard operation
lighttrack copied to clipboard

str2bool / DictAction (from torchlight)

Open petteriTeikari opened this issue 5 years ago • 5 comments

I assume for your demo script, there is an error with the torchlight and the IO functions from: https://github.com/yysijie/st-gcn/blob/master/torchlight/torchlight/io.py

I get this error:

lighttrack/graph/gcn_utils/io.py", line 18, in <module>
    from torchlight import str2bool
ImportError: cannot import name 'str2bool'

But those "to be imported" modules are found there: https://github.com/yysijie/st-gcn/blob/master/torchlight/torchlight/io.py

petteriTeikari avatar Jun 25 '19 16:06 petteriTeikari

Have you solved this problem? I also have this problem.

idotc avatar Aug 29 '19 14:08 idotc

Please make sure to install torchlight by running: cd ../graph/torchlight; python setup.py install within your active environment (conda or virtualenv). It will work afterward.

rafox2005 avatar Sep 03 '19 14:09 rafox2005

I have same Error. I tried sudo python3 setup.py install It ran NO Error. maybe...

(py36) zunda@zunda:~/GitHub/lighttrack$ cd ./graph/torchlight
(py36) zunda@zunda:~/GitHub/lighttrack/graph/torchlight$ sudo python3 setup.py install
running install
running bdist_egg
running egg_info
writing torchlight.egg-info/PKG-INFO
writing dependency_links to torchlight.egg-info/dependency_links.txt
writing top-level names to torchlight.egg-info/top_level.txt
reading manifest file 'torchlight.egg-info/SOURCES.txt'
writing manifest file 'torchlight.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/torchlight
copying build/lib/torchlight/__init__.py -> build/bdist.linux-x86_64/egg/torchlight
copying build/lib/torchlight/gpu.py -> build/bdist.linux-x86_64/egg/torchlight
copying build/lib/torchlight/io.py -> build/bdist.linux-x86_64/egg/torchlight
byte-compiling build/bdist.linux-x86_64/egg/torchlight/__init__.py to __init__.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/torchlight/gpu.py to gpu.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/torchlight/io.py to io.cpython-36.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying torchlight.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying torchlight.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying torchlight.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying torchlight.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist/torchlight-1.0-py3.6.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing torchlight-1.0-py3.6.egg
Removing /usr/local/lib/python3.6/dist-packages/torchlight-1.0-py3.6.egg
Copying torchlight-1.0-py3.6.egg to /usr/local/lib/python3.6/dist-packages
torchlight 1.0 is already the active version in easy-install.pth

Installed /usr/local/lib/python3.6/dist-packages/torchlight-1.0-py3.6.egg
Processing dependencies for torchlight==1.0
Finished processing dependencies for torchlight==1.0
(py36) zunda@zunda:~/GitHub/lighttrack/graph/torchlight$
(py36) zunda@zunda:~/GitHub/lighttrack/graph/torchlight$ cd ../../
(py36) zunda@zunda:~/GitHub/lighttrack$ python3 demo_camera_mobile.py
/home/zunda/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/home/zunda/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/home/zunda/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/home/zunda/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/home/zunda/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/home/zunda/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
/home/zunda/.local/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/home/zunda/.local/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/home/zunda/.local/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/home/zunda/.local/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/home/zunda/.local/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/home/zunda/.local/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
WARNING:tensorflow:From /home/zunda/GitHub/lighttrack/HPE/../lib/nets/mobilenet_v1.py:440: The name tf.GraphKeys is deprecated. Please use tf.compat.v1.GraphKeys instead.

Detector YOLOv3 options: Namespace(batch_size=1, checkpoint_model=None, conf_thres=0.8, config_path='detector/config/yolov3.cfg', img_size=416, n_cpu=8, nms_thres=0.4, weights_path='weights/YOLOv3/yolov3.weights')
PoseTrack order.
Traceback (most recent call last):
  File "demo_camera_mobile.py", line 34, in <module>
    from graph import visualize_pose_matching
  File "/home/zunda/GitHub/lighttrack/graph/visualize_pose_matching.py", line 151, in <module>
    from gcn_utils.io import IO
  File "/home/zunda/GitHub/lighttrack/graph/gcn_utils/io.py", line 18, in <module>
    from torchlight import str2bool
ImportError: cannot import name 'str2bool'
(py36) zunda@zunda:~/GitHub/lighttrack$ 

zunda-pixel avatar Jul 27 '20 02:07 zunda-pixel

I also have this problem. Because it automatically call the torchlight package in python first, maybe you can try pip uninstall torchlightand modify import to from torchlight.torchlight.io import. I tried it can solve this.

Hesper-i avatar Apr 10 '22 09:04 Hesper-i

i have the same problem. from torchlight import str2bool . i tried to uninstall torchlight and installed it again. i also tried from torchlight.torchlight.io import i get the same error

nozhajlidi avatar Jun 16 '22 09:06 nozhajlidi