Hi - I'm running the convert on TF 2.20 and encounter an error regarding using a tf.Tensor as bool - I'll test on 2.1 next but wanted to put this error out now since more people will be using 2.20 soon.
C:\Users\lessw\tf2yolo4>python convert_tflite.py --weights ./data/yolov4.weights --output ./data/yolov4.tflite 2020-05-05 09:55:27.109218: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll 2020-05-05 09:55:28.977261: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll 2020-05-05 09:55:29.034033: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1544] Found device 0 with properties: pciBusID: 0000:01:00.0 name: GeForce RTX 2070 computeCapability: 7.5 coreClock: 1.125GHz coreCount: 36 deviceMemorySize: 8.00GiB deviceMemoryBandwidth: 327.88GiB/s 2020-05-05 09:55:29.037768: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll 2020-05-05 09:55:29.041449: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_10.dll 2020-05-05 09:55:29.045138: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cufft64_10.dll 2020-05-05 09:55:29.047094: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library curand64_10.dll 2020-05-05 09:55:29.050725: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusolver64_10.dll 2020-05-05 09:55:29.054087: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusparse64_10.dll 2020-05-05 09:55:29.059581: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll 2020-05-05 09:55:29.062256: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1686] Adding visible gpu devices: 0 2020-05-05 09:55:29.063914: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with Intel(R) MKL-DNN to use the following CPU instructions in performance-critical operations: AVX2 To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. 2020-05-05 09:55:29.074065: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x1b8334c57a0 initialized for platform Host (this does not guarantee that XLA will be used). Devices: 2020-05-05 09:55:29.076775: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version 2020-05-05 09:55:29.078977: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1544] Found device 0 with properties: pciBusID: 0000:01:00.0 name: GeForce RTX 2070 computeCapability: 7.5 coreClock: 1.125GHz coreCount: 36 deviceMemorySize: 8.00GiB deviceMemoryBandwidth: 327.88GiB/s 2020-05-05 09:55:29.082237: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll 2020-05-05 09:55:29.084764: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_10.dll 2020-05-05 09:55:29.086438: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cufft64_10.dll 2020-05-05 09:55:29.088690: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library curand64_10.dll 2020-05-05 09:55:29.090423: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusolver64_10.dll 2020-05-05 09:55:29.092110: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusparse64_10.dll 2020-05-05 09:55:29.093784: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll 2020-05-05 09:55:29.095770: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1686] Adding visible gpu devices: 0 2020-05-05 09:55:29.614514: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1085] Device interconnect StreamExecutor with strength 1 edge matrix: 2020-05-05 09:55:29.616276: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1091] 0 2020-05-05 09:55:29.617448: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1104] 0: N 2020-05-05 09:55:29.619011: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1230] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 6230 MB memory) -> physical GPU (device: 0, name: GeForce RTX 2070, pci bus id: 0000:01:00.0, compute capability: 7.5) 2020-05-05 09:55:29.624471: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x1b85ebd15f0 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices: 2020-05-05 09:55:29.626731: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): GeForce RTX 2070, Compute Capability 7.5 WARNING:tensorflow:AutoGraph could not transform <bound method BatchNormalization.call of <core.common.BatchNormalization object at 0x000001B833E27908>> and will run it as-is. Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux,
export AUTOGRAPH_VERBOSITY=10) and attach the full output. Cause: 'arguments' object has no attribute 'posonlyargs' To silence this warning, decorate the function with @tf.autograph.experimental.do_not_convert W0505 09:55:29.957932 21456 ag_logging.py:146] AutoGraph could not transform <bound method BatchNormalization.call of <core.common.BatchNormalization object at 0x000001B833E27908>> and will run it as-is. Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux,
export AUTOGRAPH_VERBOSITY=10`) and attach the full output.
Cause: 'arguments' object has no attribute 'posonlyargs'
To silence this warning, decorate the function with @tf.autograph.experimental.do_not_convert
Traceback (most recent call last):
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\autograph\impl\api.py", line 578, in converted_call
converted_f = conversion.convert(target_entity, program_ctx)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\autograph\impl\conversion.py", line 101, in convert
entity, program_ctx.options, program_ctx, custom_vars)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\autograph\pyct\transpiler.py", line 412, in transform_function
extra_locals)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\autograph\pyct\transpiler.py", line 373, in _transformed_factory
nodes, ctx = self._transform_function(fn, user_context)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\autograph\pyct\transpiler.py", line 339, in _transform_function
node = self.transform_ast(node, context)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\autograph\impl\conversion.py", line 61, in transform_ast
node = converter.standard_analysis(node, ctx, is_initial=True)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\autograph\core\converter.py", line 355, in standard_analysis
node = activity.resolve(node, context, None)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\autograph\pyct\static_analysis\activity.py", line 685, in resolve
return ActivityAnalyzer(context, parent_scope).visit(node)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\autograph\pyct\transformer.py", line 436, in visit
result = super(Base, self).visit(node)
File "C:\Users\lessw\anaconda3\lib\ast.py", line 271, in visit
return visitor(node)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\autograph\pyct\static_analysis\activity.py", line 569, in visit_FunctionDef
node = self._visit_arg_annotations(node)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\autograph\pyct\static_analysis\activity.py", line 545, in _visit_arg_annotations
node = self._visit_arg_declarations(node)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\autograph\pyct\static_analysis\activity.py", line 550, in _visit_arg_declarations
node.args.posonlyargs = self._visit_node_list(node.args.posonlyargs)
AttributeError: 'arguments' object has no attribute 'posonlyargs'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\keras\engine\base_layer.py", line 943, in call
outputs = call_fn(cast_inputs, *args, **kwargs)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\autograph\impl\api.py", line 259, in wrapper
return converted_call(f, args, kwargs, options=options)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\autograph\impl\api.py", line 585, in converted_call
return _fall_back_unconverted(f, args, kwargs, options, e)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\autograph\impl\api.py", line 393, in _fall_back_unconverted
return _call_unconverted(f, args, kwargs, options)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\autograph\impl\api.py", line 343, in _call_unconverted
return f(*args, **kwargs)
File "C:\Users\lessw\tf2yolo4\core\common.py", line 14, in call
if not training:
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\framework\ops.py", line 926, in bool
self._disallow_bool_casting()
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\framework\ops.py", line 539, in _disallow_bool_casting
self._disallow_in_graph_mode("using a tf.Tensor
as a Python bool
")
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\framework\ops.py", line 528, in _disallow_in_graph_mode
" this function with @tf.function.".format(task))
tensorflow.python.framework.errors_impl.OperatorNotAllowedInGraphError: using a tf.Tensor
as a Python bool
is not allowed in Graph execution. Use Eager execution or decorate this function with @tf.function.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "convert_tflite.py", line 109, in
app.run(main)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\absl\app.py", line 299, in run
_run_main(main, args)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\absl\app.py", line 250, in _run_main
sys.exit(main(argv))
File "convert_tflite.py", line 104, in main
save_tflite()
File "convert_tflite.py", line 53, in save_tflite
feature_maps = YOLOv4(input_layer, NUM_CLASS)
File "C:\Users\lessw\tf2yolo4\core\yolov4.py", line 60, in YOLOv4
route_1, route_2, conv = backbone.cspdarknet53(input_layer)
File "C:\Users\lessw\tf2yolo4\core\backbone.py", line 41, in cspdarknet53
input_data = common.convolutional(input_data, (3, 3, 3, 32), activate_type="mish")
File "C:\Users\lessw\tf2yolo4\core\common.py", line 33, in convolutional
if bn: conv = BatchNormalization()(conv)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\keras\engine\base_layer.py", line 955, in call
str(e) + '\n"""')
TypeError: You are attempting to use Python control flow in a layer that was not declared to be dynamic. Pass dynamic=True
to the class constructor.
Encountered error:
"""
using a tf.Tensor
as a Python bool
is not allowed in Graph execution. Use Eager execution or decorate this function with @tf.function.
"""
C:\Users\lessw\tf2yolo4>
C:\Users\lessw\tf2yolo4>python convert_tflite.py --weights ./data/yolov4.weights --output ./data/yolov4-fp16.tflite --quantize_mode float16
2020-05-05 09:55:50.534712: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
2020-05-05 09:55:52.407068: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll
2020-05-05 09:55:52.464449: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1544] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: GeForce RTX 2070 computeCapability: 7.5
coreClock: 1.125GHz coreCount: 36 deviceMemorySize: 8.00GiB deviceMemoryBandwidth: 327.88GiB/s
2020-05-05 09:55:52.468171: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
2020-05-05 09:55:52.471904: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_10.dll
2020-05-05 09:55:52.475932: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cufft64_10.dll
2020-05-05 09:55:52.477943: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library curand64_10.dll
2020-05-05 09:55:52.481599: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusolver64_10.dll
2020-05-05 09:55:52.484848: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusparse64_10.dll
2020-05-05 09:55:52.490466: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll
2020-05-05 09:55:52.493474: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1686] Adding visible gpu devices: 0
2020-05-05 09:55:52.494907: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with Intel(R) MKL-DNN to use the following CPU instructions in performance-critical operations: AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2020-05-05 09:55:52.504471: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x1f0a58c8620 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-05-05 09:55:52.506869: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
2020-05-05 09:55:52.508837: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1544] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: GeForce RTX 2070 computeCapability: 7.5
coreClock: 1.125GHz coreCount: 36 deviceMemorySize: 8.00GiB deviceMemoryBandwidth: 327.88GiB/s
2020-05-05 09:55:52.512381: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
2020-05-05 09:55:52.514151: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_10.dll
2020-05-05 09:55:52.515867: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cufft64_10.dll
2020-05-05 09:55:52.517476: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library curand64_10.dll
2020-05-05 09:55:52.519616: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusolver64_10.dll
2020-05-05 09:55:52.521364: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusparse64_10.dll
2020-05-05 09:55:52.523083: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll
2020-05-05 09:55:52.525053: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1686] Adding visible gpu devices: 0
2020-05-05 09:55:53.033268: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1085] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-05-05 09:55:53.035123: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1091] 0
2020-05-05 09:55:53.036180: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1104] 0: N
2020-05-05 09:55:53.037673: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1230] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 6230 MB memory) -> physical GPU (device: 0, name: GeForce RTX 2070, pci bus id: 0000:01:00.0, compute capability: 7.5)
2020-05-05 09:55:53.042743: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x1f0d16ea700 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
2020-05-05 09:55:53.044876: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): GeForce RTX 2070, Compute Capability 7.5
WARNING:tensorflow:AutoGraph could not transform <bound method BatchNormalization.call of <core.common.BatchNormalization object at 0x000001F0A66A7BC8>> and will run it as-is.
Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, export AUTOGRAPH_VERBOSITY=10
) and attach the full output.
Cause: 'arguments' object has no attribute 'posonlyargs'
To silence this warning, decorate the function with @tf.autograph.experimental.do_not_convert
W0505 09:55:53.370318 18732 ag_logging.py:146] AutoGraph could not transform <bound method BatchNormalization.call of <core.common.BatchNormalization object at 0x000001F0A66A7BC8>> and will run it as-is.
Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, export AUTOGRAPH_VERBOSITY=10
) and attach the full output.
Cause: 'arguments' object has no attribute 'posonlyargs'
To silence this warning, decorate the function with @tf.autograph.experimental.do_not_convert
Traceback (most recent call last):
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\autograph\impl\api.py", line 578, in converted_call
converted_f = conversion.convert(target_entity, program_ctx)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\autograph\impl\conversion.py", line 101, in convert
entity, program_ctx.options, program_ctx, custom_vars)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\autograph\pyct\transpiler.py", line 412, in transform_function
extra_locals)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\autograph\pyct\transpiler.py", line 373, in _transformed_factory
nodes, ctx = self._transform_function(fn, user_context)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\autograph\pyct\transpiler.py", line 339, in _transform_function
node = self.transform_ast(node, context)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\autograph\impl\conversion.py", line 61, in transform_ast
node = converter.standard_analysis(node, ctx, is_initial=True)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\autograph\core\converter.py", line 355, in standard_analysis
node = activity.resolve(node, context, None)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\autograph\pyct\static_analysis\activity.py", line 685, in resolve
return ActivityAnalyzer(context, parent_scope).visit(node)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\autograph\pyct\transformer.py", line 436, in visit
result = super(Base, self).visit(node)
File "C:\Users\lessw\anaconda3\lib\ast.py", line 271, in visit
return visitor(node)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\autograph\pyct\static_analysis\activity.py", line 569, in visit_FunctionDef
node = self._visit_arg_annotations(node)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\autograph\pyct\static_analysis\activity.py", line 545, in _visit_arg_annotations
node = self._visit_arg_declarations(node)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\autograph\pyct\static_analysis\activity.py", line 550, in _visit_arg_declarations
node.args.posonlyargs = self._visit_node_list(node.args.posonlyargs)
AttributeError: 'arguments' object has no attribute 'posonlyargs'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\keras\engine\base_layer.py", line 943, in call
outputs = call_fn(cast_inputs, *args, **kwargs)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\autograph\impl\api.py", line 259, in wrapper
return converted_call(f, args, kwargs, options=options)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\autograph\impl\api.py", line 585, in converted_call
return _fall_back_unconverted(f, args, kwargs, options, e)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\autograph\impl\api.py", line 393, in _fall_back_unconverted
return _call_unconverted(f, args, kwargs, options)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\autograph\impl\api.py", line 343, in _call_unconverted
return f(*args, **kwargs)
File "C:\Users\lessw\tf2yolo4\core\common.py", line 14, in call
if not training:
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\framework\ops.py", line 926, in bool
self._disallow_bool_casting()
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\framework\ops.py", line 539, in _disallow_bool_casting
self._disallow_in_graph_mode("using a tf.Tensor
as a Python bool
")
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\framework\ops.py", line 528, in _disallow_in_graph_mode
" this function with @tf.function.".format(task))
tensorflow.python.framework.errors_impl.OperatorNotAllowedInGraphError: using a tf.Tensor
as a Python bool
is not allowed in Graph execution. Use Eager execution or decorate this function with @tf.function.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "convert_tflite.py", line 109, in
app.run(main)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\absl\app.py", line 299, in run
_run_main(main, args)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\absl\app.py", line 250, in _run_main
sys.exit(main(argv))
File "convert_tflite.py", line 104, in main
save_tflite()
File "convert_tflite.py", line 53, in save_tflite
feature_maps = YOLOv4(input_layer, NUM_CLASS)
File "C:\Users\lessw\tf2yolo4\core\yolov4.py", line 60, in YOLOv4
route_1, route_2, conv = backbone.cspdarknet53(input_layer)
File "C:\Users\lessw\tf2yolo4\core\backbone.py", line 41, in cspdarknet53
input_data = common.convolutional(input_data, (3, 3, 3, 32), activate_type="mish")
File "C:\Users\lessw\tf2yolo4\core\common.py", line 33, in convolutional
if bn: conv = BatchNormalization()(conv)
File "C:\Users\lessw\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\keras\engine\base_layer.py", line 955, in call
str(e) + '\n"""')
TypeError: You are attempting to use Python control flow in a layer that was not declared to be dynamic. Pass dynamic=True
to the class constructor.
Encountered error:
"""
using a tf.Tensor
as a Python bool
is not allowed in Graph execution. Use Eager execution or decorate this function with @tf.function.
"""`