I'm a software engineer focusing on machine learning, computer vision, and robotics with 25+ years of software development experience.
Check out my full profile, my youtube portfolio and my repos.
Contact me on linkedin.
An object detection python library predicting object coordinates and orientation angles on 2d images.
Home Page: https://ivan-alles.github.io/localizer/
License: MIT License
I'm a software engineer focusing on machine learning, computer vision, and robotics with 25+ years of software development experience.
Check out my full profile, my youtube portfolio and my repos.
Contact me on linkedin.
(py36) (localizer-main-VK8Pfd4G) C:\Users\internship\Desktop\localizer-main>python localizer\train.py models\maps\config.json
Filter "validate" contains 4 data elements
Traceback (most recent call last):
File "localizer\train.py", line 981, in <module>
trainer.run()
File "localizer\train.py", line 374, in run
self._read_dataset()
File "localizer\train.py", line 441, in _read_dataset
total_obj_count_by_cat[obj.category] += 1
KeyError: 1
Thank @ivan-alles for sharing a great work.
Iam quite curious about the method you used for detecting the orientation of the objects.
Can you explain it a bit or give me a reference to look at ?
Thank you in advance.
Got this error:
(py36) (localizer-main-VK8Pfd4G) C:\Users\internship\Desktop\localizer-main>python localizer\predict_for_images.py models\tools\config.json datasets\tools
2021-08-30 07:56:08.984216: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-08-30 07:56:09.538818: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1510] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 10815 MB memory: -> device: 0, name: Tesla K80, pci bus id: 0001:00:00.0, compute capability: 3.7
WARNING:tensorflow:No training configuration found in save file, so the model was *not* compiled. Compile it manually.
2021-08-30 07:56:10.462987: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:185] None of the MLIR Optimization Passes are enabled (registered 2)
2021-08-30 07:56:11.098206: I tensorflow/stream_executor/cuda/cuda_dnn.cc:369] Loaded cuDNN version 8202
Traceback (most recent call last):
File "localizer\predict_for_images.py", line 31, in <module>
predictions = localizer.predict(image)
File "C:\Users\internship\Desktop\localizer-main\localizer\predict.py", line 264, in predict
result = self._model.predict(batch.inputs)
File "C:\Users\internship\.virtualenvs\localizer-main-VK8Pfd4G\lib\site-packages\keras\engine\training.py", line 1751, in predict
tmp_batch_outputs = self.predict_function(iterator)
File "C:\Users\internship\.virtualenvs\localizer-main-VK8Pfd4G\lib\site-packages\tensorflow\python\eager\def_function.py", line 885, in __call__
result = self._call(*args, **kwds)
File "C:\Users\internship\.virtualenvs\localizer-main-VK8Pfd4G\lib\site-packages\tensorflow\python\eager\def_function.py", line 933, in _call
self._initialize(args, kwds, add_initializers_to=initializers)
File "C:\Users\internship\.virtualenvs\localizer-main-VK8Pfd4G\lib\site-packages\tensorflow\python\eager\def_function.py", line 760, in _initialize
*args, **kwds))
File "C:\Users\internship\.virtualenvs\localizer-main-VK8Pfd4G\lib\site-packages\tensorflow\python\eager\function.py", line 3066, in _get_concrete_function_internal_garbage_collected
graph_function, _ = self._maybe_define_function(args, kwargs)
File "C:\Users\internship\.virtualenvs\localizer-main-VK8Pfd4G\lib\site-packages\tensorflow\python\eager\function.py", line 3463, in _maybe_define_function
graph_function = self._create_graph_function(args, kwargs)
File "C:\Users\internship\.virtualenvs\localizer-main-VK8Pfd4G\lib\site-packages\tensorflow\python\eager\function.py", line 3308, in _create_graph_function
capture_by_value=self._capture_by_value),
File "C:\Users\internship\.virtualenvs\localizer-main-VK8Pfd4G\lib\site-packages\tensorflow\python\framework\func_graph.py", line 1007, in func_graph_from_py_func
func_outputs = python_func(*func_args, **func_kwargs)
File "C:\Users\internship\.virtualenvs\localizer-main-VK8Pfd4G\lib\site-packages\tensorflow\python\eager\def_function.py", line 668, in wrapped_fn
out = weak_wrapped_fn().__wrapped__(*args, **kwds)
File "C:\Users\internship\.virtualenvs\localizer-main-VK8Pfd4G\lib\site-packages\tensorflow\python\framework\func_graph.py", line 994, in wrapper
raise e.ag_error_metadata.to_exception(e)
TypeError: in user code:
C:\Users\internship\.virtualenvs\localizer-main-VK8Pfd4G\lib\site-packages\keras\engine\training.py:1586 predict_function *
return step_function(self, iterator)
C:\Users\internship\.virtualenvs\localizer-main-VK8Pfd4G\lib\site-packages\keras\engine\training.py:1576 step_function **
outputs = model.distribute_strategy.run(run_step, args=(data,))
C:\Users\internship\.virtualenvs\localizer-main-VK8Pfd4G\lib\site-packages\tensorflow\python\distribute\distribute_lib.py:1286 run
return self._extended.call_for_each_replica(fn, args=args, kwargs=kwargs)
C:\Users\internship\.virtualenvs\localizer-main-VK8Pfd4G\lib\site-packages\tensorflow\python\distribute\distribute_lib.py:2849 call_for_each_replica
return self._call_for_each_replica(fn, args, kwargs)
C:\Users\internship\.virtualenvs\localizer-main-VK8Pfd4G\lib\site-packages\tensorflow\python\distribute\distribute_lib.py:3632 _call_for_each_replica
return fn(*args, **kwargs)
C:\Users\internship\.virtualenvs\localizer-main-VK8Pfd4G\lib\site-packages\keras\engine\training.py:1569 run_step **
outputs = model.predict_step(data)
C:\Users\internship\.virtualenvs\localizer-main-VK8Pfd4G\lib\site-packages\keras\engine\training.py:1537 predict_step
return self(x, training=False)
C:\Users\internship\.virtualenvs\localizer-main-VK8Pfd4G\lib\site-packages\keras\engine\base_layer.py:1037 __call__
outputs = call_fn(inputs, *args, **kwargs)
C:\Users\internship\.virtualenvs\localizer-main-VK8Pfd4G\lib\site-packages\keras\engine\functional.py:415 call
inputs, training=training, mask=mask)
C:\Users\internship\.virtualenvs\localizer-main-VK8Pfd4G\lib\site-packages\keras\engine\functional.py:550 _run_internal_graph
outputs = node.layer(*args, **kwargs)
C:\Users\internship\.virtualenvs\localizer-main-VK8Pfd4G\lib\site-packages\keras\engine\base_layer.py:1044 __call__
self._set_save_spec(inputs, args, kwargs)
C:\Users\internship\.virtualenvs\localizer-main-VK8Pfd4G\lib\site-packages\tensorflow\python\training\tracking\base.py:530 _method_wrapper
result = method(self, *args, **kwargs)
C:\Users\internship\.virtualenvs\localizer-main-VK8Pfd4G\lib\site-packages\keras\engine\base_layer.py:3040 _set_save_spec
flat_specs = [tf_utils.get_tensor_spec(x) for x in flat_arg]
C:\Users\internship\.virtualenvs\localizer-main-VK8Pfd4G\lib\site-packages\keras\engine\base_layer.py:3040 <listcomp>
flat_specs = [tf_utils.get_tensor_spec(x) for x in flat_arg]
C:\Users\internship\.virtualenvs\localizer-main-VK8Pfd4G\lib\site-packages\keras\utils\tf_utils.py:467 get_tensor_spec
spec = tf.TensorSpec(shape=t.shape, dtype=t.dtype, name=name)
C:\Users\internship\.virtualenvs\localizer-main-VK8Pfd4G\lib\site-packages\tensorflow\python\framework\tensor_spec.py:51 __init__
self._shape = tensor_shape.TensorShape(shape)
C:\Users\internship\.virtualenvs\localizer-main-VK8Pfd4G\lib\site-packages\tensorflow\python\framework\tensor_shape.py:784 __init__
self._dims = [as_dimension(dims)]
C:\Users\internship\.virtualenvs\localizer-main-VK8Pfd4G\lib\site-packages\tensorflow\python\framework\tensor_shape.py:729 as_dimension
return Dimension(value)
C:\Users\internship\.virtualenvs\localizer-main-VK8Pfd4G\lib\site-packages\tensorflow\python\framework\tensor_shape.py:209 __init__
.format(value, type(value))), None)
<string>:3 raise_from
TypeError: Dimension value must be integer or None or have an __index__ method, got value '<attribute 'shape' of 'numpy.generic' objects>' with type '<class 'getset_descriptor'>'
Any ideas why this is occuring?
Thank you for the great work. I just tried out the localizer with the hands_on_demo.py. Capturing the dataset and training seems to work, but during the prediction it seems to have problems (maybe related to #3). I am using the tensorflow metal package and running it on an M1. And yes, I am using a standard RGB webcam.
Would be great if you could give me a hint what could be the problem here:
Backend MacOSX is interactive backend. Turning interactive mode on.
Metal device set to: Apple M1 Max
systemMemory: 64.00 GB
maxCacheSize: 24.00 GB
2022-08-26 12:14:50.225504: I tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.cc:305] Could not identify NUMA node of platform GPU ID 0, defaulting to 0. Your kernel may not have been built with NUMA support.
2022-08-26 12:14:50.225657: I tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.cc:271] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 0 MB memory) -> physical PluggableDevice (device: 0, name: METAL, pci bus id: <undefined>)
WARNING:tensorflow:No training configuration found in save file, so the model was *not* compiled. Compile it manually.
2022-08-26 12:15:35.760479: W tensorflow/core/platform/profile_utils/cpu_utils.cc:128] Failed to get CPU frequency: 0 Hz
2022-08-26 12:15:35.892807: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.
1/1 [==============================] - 0s 206ms/step
Traceback (most recent call last):
File "tmp/localizer/localizer/hands_on_demo.py", line 111, in _detect
objects = self._localizer.predict(input)
File "tmp/localizer/localizer/predict.py", line 250, in predict
self._update_input_image_parameters(image.shape)
File "tmp/localizer/localizer/predict.py", line 109, in _update_input_image_parameters
self._create_model()
File "tmp/localizer/localizer/predict.py", line 212, in _create_model
yx = tf.gather_nd(average_pos, local_max_idx) + tf.cast(local_max_idx[:, 2:], np.float32)
File "tmp/localizer/venv/lib/python3.9/site-packages/tensorflow/python/util/traceback_utils.py", line 153, in error_handler
raise e.with_traceback(filtered_tb) from None
File "tmp/localizer/venv/lib/python3.9/site-packages/keras/layers/core/tf_op_layer.py", line 107, in handle
return TFOpLambda(op)(*args, **kwargs)
File "tmp/localizer/venv/lib/python3.9/site-packages/keras/utils/traceback_utils.py", line 67, in error_handler
raise e.with_traceback(filtered_tb) from None
File "<string>", line 3, in raise_from
TypeError: Dimension value must be integer or None or have an __index__ method, got value '<attribute 'shape' of 'numpy.generic' objects>' with type '<class 'getset_descriptor'>'
Hey @ivan-alles ,
Nice work! I'm trying to use the package on a ubuntu 20.04, with python 3.9. However there are some dependencies that are deprecated, e.g., the robogym.
I also see that you just use limited functions from robogym, so do you think it's possible to remove the dependency on robogym?
Thanks in advance.
Thanks for your good work. I want to know if it is possible to use a localizer with YOLO?
I want to detect an object (bounding boxes) and its orientation at the same time.
I am unable to train models using these files.
for reference:ML program
Getting the following error:
(localizer-main-VK8Pfd4G) (py36) C:\Users\internship\Desktop\localizer-main>python localizer\train.py models\maps\config.json 2021-11-16 09:45:50.877785: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll Filter "validate" contains 3 data elements Traceback (most recent call last): File "localizer\train.py", line 981, in <module> trainer.run() File "localizer\train.py", line 374, in run self._read_dataset() File "localizer\train.py", line 456, in _read_dataset assert np.allclose(1, flt.data_element_weights.sum()), flt_name AssertionError: validate
is there a particular reason?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.