Tensorflow Object-detection model training failed on google cloud - tensorflow

ERROR 2017-11-23 18:39:51 -0800 service The replica worker 2 exited
with a non-zero status of 1. Termination reason: Error.
ERROR 2017-11-23 18:39:51 -0800 service Traceback (most recent call
last):
ERROR 2017-11-23 18:39:51 -0800 service File
"/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
ERROR 2017-11-23 18:39:51 -0800 service "main", fname,
loader, pkg_name)
ERROR 2017-11-23 18:39:51 -0800 service File
"/usr/lib/python2.7/runpy.py", line 72, in _run_code
ERROR 2017-11-23
18:39:51 -0800 service exec code in run_globals
ERROR 2017-11-23
18:39:51 -0800 service File
"/root/.local/lib/python2.7/site-packages/object_detection/train.py",
line 49, in
ERROR 2017-11-23 18:39:51 -0800 service from
object_detection import trainer
ERROR 2017-11-23 18:39:51
-0800 service File "/root/.local/lib/python2.7/site-packages/object_detection/trainer.py",
line 27, in
ERROR 2017-11-23 18:39:51 -0800 service from
object_detection.builders import preprocessor_builder
ERROR 2017-11-23
18:39:51 -0800 service File
"/root/.local/lib/python2.7/site-packages/object_detection/builders/preprocessor_builder.py",
line 21, in
ERROR 2017-11-23 18:39:51 -0800 service from
object_detection.protos import preprocessor_pb2
ERROR 2017-11-23
18:39:51 -0800 service File
"/root/.local/lib/python2.7/site-packages/object_detection/protos/preprocessor_pb2.py",
line 71, in
ERROR 2017-11-23 18:39:51 -0800 service options=None, file=DESCRIPTOR),
ERROR 2017-11-23 18:39:51
-0800 service TypeError: new() got an unexpected keyword argument 'file'
Using protobuf (3.5.0.post1)
But when I run taining local, no error!

The Cloud ML Engine doesn't support the latest versions of TensorFlow or protobuf. You can see the current packages and versions here. Did you add protobuf to the list of required packages in setup.py?
In setup.py, you can request a more current version of TensorFlow with code like the following:
REQUIRED_PACKAGES = ['tensorflow>=1.3']
setup(
...
install_requires=REQUIRED_PACKAGES,
...
)

Related

ninja WebRtc build error :ninja: build stopped: subcommand failed

WSL + Ubuntu18.04 + webrtc
This project is proper functioning in Ubuntu 18.04 doesn't with WSL;
gn command:
gn gen out/SDK --args='target_os="android" target_cpu="arm" is_debug=true rtc_use_h264=true use_openh264=true rtc_libvpx_build_vp9=false rtc_build_libvpx=true rtc_include_tests=false rtc_include_ilbc=false rtc_include_pulse_audio=false ffmpeg_branding="Chrome"'
error Info :
ninja: Entering directory `out/SDK'
[2138/5820] ACTION
//api/video:video_frame_enums(//build/toolchain/android:android_clang_arm)
FAILED: gen/api/video/video_frame_enums.srcjar
python ../../build/android/gyp/java_cpp_enum.py --depfile gen/api/video/video_frame_enums.d --srcjar=gen/api/video/video_frame_enums.srcjar ../../api/video/video_codec_type.h
Traceback (most recent call last):
File "../../build/android/gyp/java_cpp_enum.py", line 437, in <module>
DoMain(sys.argv[1:])
File "../../build/android/gyp/java_cpp_enum.py", line 429, in DoMain
for output_path, data in DoGenerate(input_paths):
File "../../build/android/gyp/java_cpp_enum.py", line 329, in DoGenerate
source_path)
Exception: No enums found in ../../api/video/video_codec_type.h
Did you forget prefixing enums with "// GENERATED_JAVA_ENUM_PACKAGE: foo"?
[2140/5820] ACTION //api:rtp_parameters_enums(//build/toolchain/android:android_clang_arm)
FAILED: gen/api/rtp_parameters_enums.srcjar
python ../../build/android/gyp/java_cpp_enum.py --depfile gen/api/rtp_parameters_enums.d --srcjar=gen/api/rtp_parameters_enums.srcjar ../../api/rtp_parameters.h
Traceback (most recent call last):
File "../../build/android/gyp/java_cpp_enum.py", line 437, in <module>
DoMain(sys.argv[1:])
File "../../build/android/gyp/java_cpp_enum.py", line 429, in DoMain
for output_path, data in DoGenerate(input_paths):
File "../../build/android/gyp/java_cpp_enum.py", line 329, in DoGenerate
source_path)
Exception: No enums found in ../../api/rtp_parameters.h
Did you forget prefixing enums with "// GENERATED_JAVA_ENUM_PACKAGE: foo"?
[2143/5820] CC obj/third_party/libaom/libaom_intrinsics_neon/av1_inv_txfm_neon.o
ninja: build stopped: subcommand failed.
How can I change it to compile properly?

Google App Engine throwing error pointing to my use of chrome and chrome driver for selenium

I am using selenium and have the following code, I know the Traceback I get is pointing to the following code :
driverOptions = webdriver.ChromeOptions()
driverOptions.binary_location = 'Application_2/chrome.exe'
driverOptions.add_argument("--headless")
driver = webdriver.Chrome('Application_2/chromedriver_win32/chromedriver.exe',
chrome_options=driverOptions)
However when I try to deploy to Google App Engine, I get the following Error:
Updating service [default] (this may take several minutes)...failed.
ERROR: (gcloud.app.deploy) Error Response: [9] An internal error occurred while processing
task /app-engine-flex/flex_await_healthy/flex_await_healthy>2021-10-29T09:56:17.969Z1225.he.0:
[2021-10-29 09:57:41 +0000] [1] [INFO] Starting gunicorn 20.1.0
[2021-10-29 09:57:41 +0000] [1] [INFO] Listening at: http://0.0.0.0:8080 (1)
[2021-10-29 09:57:41 +0000] [1] [INFO] Using worker: sync
[2021-10-29 09:57:41 +0000] [11] [INFO] Booting worker with pid: 11
[2021-10-29 09:57:44 +0000] [11] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/env/lib/python3.6/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
worker.init_process()
File "/env/lib/python3.6/site-packages/gunicorn/workers/base.py", line 134, in init_process
self.load_wsgi()
File "/env/lib/python3.6/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
self.wsgi = self.app.wsgi()
File "/env/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/env/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
return self.load_wsgiapp()
File "/env/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
return util.import_app(self.app_uri)
File "/env/lib/python3.6/site-packages/gunicorn/util.py", line 359, in import_app
mod = importlib.import_module(module)
File "/opt/python3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/vmagent/app/main.py", line 2, in <module>
import file_upload
File "/home/vmagent/app/file_upload.py", line 5, in <module>
import prod_class
File "/home/vmagent/app/prod_class.py", line 17, in <module>
driver = webdriver.Chrome('Application_2/chromedriver_win32/chromedriver.exe',
chrome_options=driverOptions)
File "/env/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in
__init__
self.service.start()
File "/env/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 76, in
start
stdin=PIPE)
File "/opt/python3.6/lib/python3.6/subprocess.py", line 729, in __init__
restore_signals, start_new_session)
File "/opt/python3.6/lib/python3.6/subprocess.py", line 1364, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: 'Application_2/chromedriver_win32/chromedriver.exe'
[2021-10-29 09:57:44 +0000] [11] [INFO] Worker exiting (pid: 11)
[2021-10-29 09:57:44 +0000] [1] [INFO] Shutting down: Master
[2021-10-29 09:57:44 +0000] [1] [INFO] Reason: Worker failed to boot.
Error Log On Google App engine:
'''OSError: [Errno 8] Exec format error: 'Application/chromedriver.exe'
at _execute_child (/opt/python3.9/lib/python3.9/subprocess.py:1821)
at __init__ (/opt/python3.9/lib/python3.9/subprocess.py:951)
at start (/layers/google.python.pip/pip/lib/python3.9/site-
packages/selenium/webdriver/common/service.py:72)
at __init__ (/layers/google.python.pip/pip/lib/python3.9/site-
packages/selenium/webdriver/chrome/webdriver.py:73)
at <module> (/workspace/prod_class.py:17)
at <module> (/workspace/file_upload.py:5)
at <module> (/workspace/main.py:2)
at _call_with_frames_removed (<frozen importlib._bootstrap>:228)
at exec_module (<frozen importlib._bootstrap_external>:850)
at _load_unlocked (<frozen importlib._bootstrap>:680)
at _find_and_load_unlocked (<frozen importlib._bootstrap>:986)
at _find_and_load (<frozen importlib._bootstrap>:1007)
at _gcd_import (<frozen importlib._bootstrap>:1030)
at import_module (/opt/python3.9/lib/python3.9/importlib/__init__.py:127)
at import_app (/layers/google.python.pip/pip/lib/python3.9/site-packages/gunicorn/util.py:359)
at load_wsgiapp (/layers/google.python.pip/pip/lib/python3.9/site-
packages/gunicorn/app/wsgiapp.py:48)
at load (/layers/google.python.pip/pip/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py:58)
at wsgi (/layers/google.python.pip/pip/lib/python3.9/site-packages/gunicorn/app/base.py:67)
at load_wsgi (/layers/google.python.pip/pip/lib/python3.9/site-
packages/gunicorn/workers/base.py:146)
at init_process (/layers/google.python.pip/pip/lib/python3.9/site-
packages/gunicorn/workers/base.py:134)
at spawn_worker (/layers/google.python.pip/pip/lib/python3.9/site-
packages/gunicorn/arbiter.py:589)'''
I have tried to downlaod the latest version of chrome and chromedirver and placed them within the same folder from where they are being called yet keep rnnning into this error. I am unsure fo what to do. Any help would be appreciated.
You're using a .exe file (chromedriver.exe) in Linux context which is not valid.
driverOptions = webdriver.ChromeOptions()
driverOptions.binary_location = 'Application_2/chrome.exe' # <- Here
driverOptions.add_argument("--headless")
driver = webdriver.Chrome('Application_2/chromedriver_win32/chromedriver.exe',
chrome_options=driverOptions)
You can download a Linux compatible chromedriver version going to their site. However, you wont be able to have/download it in App Engine Standard. Instead, you have to use App Engine Flex Custom Runtime, as it suits better for what you're describing, using a Docker container with chromedriver (check this quickstart for more information).
My recomendation is to have it working inside a Docker container, and then take a look at the official documentation about how to Deploy and Test your Custom Runtime Application. You might also want to check this post with a similar scenario.

I am getting this error while importing keras to shell, while I have installed tensorflow of version 2.4.1 and keras 2.4.3

C:\WINDOWS\system32>python
Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import tensorflow
Traceback (most recent call last):
File "C:\Users\vbhav\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\vbhav\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_init_.py", line 41, in
from tensorflow.python.tools import module_util as module_util
File "C:\Users\vbhav\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python_init.py", line 39, in
from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
File "C:\Users\vbhav\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 83, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\vbhav\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed: The specified module could not be found.
Failed to load the native TensorFlow runtime.
I installed Microsoft C++ redistributable application. And this error was fixed.
https://aka.ms/vs/16/release/vc_redist.x64.exe

unexpected keyword argument in tensorflow object-detection api

I am following this tutorial: https://pythonprogramming.net/introduction-use-tensorflow-object-detection-api-tutorial/ to do object detection on my own dataset and finetune the pre-trained model.
when I run this command:
python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ssd_mobilenet_v1_pets.config
I get this error:
Traceback (most recent call last):
File "train.py", line 51, in <module>
from object_detection import trainer
File "/Users/apple/Downloads/models/research/object_detection/trainer.py", line 27, in <module>
from object_detection.builders import preprocessor_builder
File "/Users/apple/Downloads/models/research/object_detection/builders/preprocessor_builder.py", line 21, in <module>
from object_detection.protos import preprocessor_pb2
File
"/Users/apple/Downloads/models/research/object_detection/protos/preprocessor_pb2.py", line 71, in <module>
options=None, file=DESCRIPTOR),
TypeError: __init__() got an unexpected keyword argument 'file'
and removing this argument does not solve this issue.
I am using macosx 10.12.6 - sierra
Any help?

python - control the browser with selenium module

I installed python version 3.5.2, selenium version 3.0.1 and firefox version 49.0.2.
After all of that and in my shell scripting I typed
>>> from selenium import webdriver
>>> browser = webdriver.Firefox()
and got error as this below:
Could someone guide me on what is wrong here.
I appreciate it. I am just starting out on python. Thanks
#
Traceback (most recent call last):
File "C:\Users\D\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\common\service.py", line 64, in start
stdout=self.log_file, stderr=self.log_file)
File "C:\Users\D\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "C:\Users\D\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 1224, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
browser = webdriver.Firefox()
File "C:\Users\D\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 135, in __init__
self.service.start()
File "C:\Users\D\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\common\service.py", line 71, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.
#