sergiomsilva / alpr-unconstrained

License Plate Detection and Recognition in Unconstrained Scenarios

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does anyone ever upgraded the build environment?

Linvail opened this issue · comments

commented

I tried to establish the environment but failed. Pip cannot find the old Keras and TensorFlow for Python 2.7.
And, the newer Kera/TensorFlow only supports Python 3.5+.
Original environment: Keras 2.2.4, TensorFlow 1.5.0, OpenCV 2.4.9, NumPy 1.14 and Python 2.7.

Does anyone ever successfully use newer toolchains to reproduce this work? Thank you.

(python27) C:>pip install tensorflow==1.5.0
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
ERROR: Could not find a version that satisfies the requirement tensorflow==1.5.0 (from versions: none)
ERROR: No matching distribution found for tensorflow==1.5.0

There seems to be a typo in your command. You've missed 's' from the package name. It's keras
pip install keras==2.2.4

commented

There seems to be a typo in your command. You've missed 's' from the package name. It's keras
pip install keras==2.2.4

Sorry for the typo. I will correct it.
In fact, that attempt was just made for the material of the previous post. I did encountered the same error on the other packages.
NumPy 1.14 and Keras 2.2.4 are okay, but TensorFlow 1.5.0 and OpenCV 2.4.9 are not.

(python27) C:>pip install TensorFlow==1.5.0
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
ERROR: Could not find a version that satisfies the requirement TensorFlow==1.5.0 (from versions: none)
ERROR: No matching distribution found for TensorFlow==1.5.0

(python27) C:>pip install tensorflow==1.5.0
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
ERROR: Could not find a version that satisfies the requirement tensorflow==1.5.0 (from versions: none)
ERROR: No matching distribution found for tensorflow==1.5.0

(python27) C:>pip install OpenCV==2.4.9
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
ERROR: Could not find a version that satisfies the requirement OpenCV==2.4.9 (from versions: none)
ERROR: No matching distribution found for OpenCV==2.4.9

Upgrade pip for tensorflow. Also, numpy>=1.19 and OpenCV>=3 will work

commented

Upgrading pip doesn't work for me. For Python 2.7, the newest is pip-20.2.3.
Is there anything I can try? Thank you.

(python27) C:>python -V
Python 2.7.18 :: Anaconda, Inc.

(python27) C:>python -m pip install -U pip
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting pip
Downloading https://files.pythonhosted.org/packages/4e/5f/528232275f6509b1fff703c9280e58951a81abe24640905de621c9f81839/pip-20.2.3-py2.py3-none-any.whl (1.5MB)
|████████████████████████████████| 1.5MB 2.0MB/s
Installing collected packages: pip
Found existing installation: pip 19.3.1
Uninstalling pip-19.3.1:
Successfully uninstalled pip-19.3.1
Successfully installed pip-20.2.3

(python27) C:>pip install tensorflow==1.5.0
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
ERROR: Could not find a version that satisfies the requirement tensorflow==1.5.0 (from versions: none)
ERROR: No matching distribution found for tensorflow==1.5.0

(python27) C:>pip install OpenCV==2.4.9
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
ERROR: Could not find a version that satisfies the requirement OpenCV==2.4.9 (from versions: none)
ERROR: No matching distribution found for OpenCV==2.4.9

(python27) C:>pip install OpenCV==2.4.13.6
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
ERROR: Could not find a version that satisfies the requirement OpenCV==2.4.13.6 (from versions: none)
ERROR: No matching distribution found for OpenCV==2.4.13.6

(python27) C:>pip install OpenCV==3.4.1
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
ERROR: Could not find a version that satisfies the requirement OpenCV==3.4.1 (from versions: none)
ERROR: No matching distribution found for OpenCV==3.4.1

For opencv:

pip install opencv-python

For tensorflow:

pip install tensorflow==1.5.1
commented

I encountered the following error when installing opencv-python.

Fortunately, the solution can be found on stackoverflow and it works for me.
https://stackoverflow.com/questions/63346648/python-2-7-installing-opencv-via-pip-virtual-environment

(python27) C:>pip install opencv-python

Collecting opencv-python
Downloading opencv-python-4.3.0.38.tar.gz (88.0 MB)
|████████████████████████████████| 88.0 MB 73 kB/s
Installing build dependencies ... done
Getting requirements to build wheel ... error
ERROR: Command errored out with exit status 1:
command: 'g:\anaconda3\envs\python27\python.exe' 'g:\anaconda3\envs\python27\lib\site-packages\pip_vendor\pep517_in_process.py' get_requir
es_for_build_wheel 'f:\temp\tmp5giz_o'
cwd: f:\temp\pip-install-kijnfc\opencv-python
Complete output (22 lines):
Traceback (most recent call last):
File "g:\anaconda3\envs\python27\lib\site-packages\pip_vendor\pep517_in_process.py", line 280, in
main()
File "g:\anaconda3\envs\python27\lib\site-packages\pip_vendor\pep517_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "g:\anaconda3\envs\python27\lib\site-packages\pip_vendor\pep517_in_process.py", line 114, in get_requires_for_build_wheel
return hook(config_settings)
File "f:\temp\pip-build-env-tszbkr\overlay\Lib\site-packages\setuptools\build_meta.py", line 146, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=['wheel'])
File "f:\temp\pip-build-env-tszbkr\overlay\Lib\site-packages\setuptools\build_meta.py", line 127, in _get_build_requires
self.run_setup()
File "f:\temp\pip-build-env-tszbkr\overlay\Lib\site-packages\setuptools\build_meta.py", line 243, in run_setup
self).run_setup(setup_script=setup_script)
File "f:\temp\pip-build-env-tszbkr\overlay\Lib\site-packages\setuptools\build_meta.py", line 142, in run_setup
exec(compile(code, file, 'exec'), locals())
File "setup.py", line 448, in
main()
File "setup.py", line 99, in main
% {"ext": re.escape(sysconfig.get_config_var("EXT_SUFFIX"))}
File "g:\anaconda3\envs\python27\lib\re.py", line 210, in escape
s = list(pattern)
TypeError: 'NoneType' object is not iterable

----------------------------------------
ERROR: Command errored out with exit status 1: 'g:\anaconda3\envs\python27\python.exe' 'g:\anaconda3\envs\python27\lib\site-packages\pip\_vendo r\pep517\_in_process.py' get_requires_for_build_wheel 'f:\temp\tmp5giz_o' Check the logs for full command output.

Pip is still unable to find tensorflow on Python 2.7.

(python27) C:>pip install tensorflow==1.5.1

ERROR: Could not find a version that satisfies the requirement tensorflow==1.5.1 (from versions: none)
ERROR: No matching distribution found for tensorflow==1.5.1

(python27) C:>pip install tensorflow

ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none)
ERROR: No matching distribution found for tensorflow

======================Python 3.8.3=======================

Found several tensorflow packages on Python 3.8.3

(base) C:>pip install tensorflow==1.5.1
ERROR: Could not find a version that satisfies the requirement tensorflow==1.5.1 (from versions: 2.2.0rc1, 2.2.0rc2, 2.2.0rc3, 2.2.0rc4, 2.2.0, 2.2.1, 2.3.0rc0, 2.3.0rc1, 2.3.0rc2, 2.3.0, 2.3.1)
ERROR: No matching distribution found for tensorflow==1.5.1

(base) C:>pip install tensorflow
Collecting tensorflow
Downloading tensorflow-2.3.1-cp38-cp38-win_amd64.whl (342.5 MB)
|██▌ | 27.7 MB 1.7 MB/s eta 0:03:11

commented

@saswat0
I forgot to mention I am on Windows 10.
It may be the reason I cannot get tensorflow for Python 2.7...

commented

@saswat0
Thank you very much.

I also want share some amateur's ideas. Just amateur's little ideas...
I noticed that some people made YOLO (even v4) support on TensorFlow, such as

Maybe it is possible to replace darknet with them, so you don't need to rely on darknet to do the vehicle detection.

I also noticed that TensorFlow 2.0+ supports Keras API as tf.keras. Maybe you can also get rid of the Keras, too.

You might be able to do the entire work with TensorFlow 2.0+ solely without building/installing darknet/Keras.

Darknet is optimised for YOLO. Using tensorflow or pytorch will result in much lesser fps than darknet alone. In fact, the only part that doesn't use darknet in this project is the license plate detection (wpod net in tensorflow) and causes the maximum lag in the entire pipeline
Keras just sits on top of tensorflow and essentially just reduces the number of lines of code. All the computations take place in tensorflow in the backend anyway. Also, migrating the entire architecture to tf2.0 will call for lots of changes

Thanks for the feedback though. I'll try to incorporate these things if possible