Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error con la deteccion de objetos #5

Open
StillOnIt opened this issue Sep 13, 2023 · 5 comments
Open

Error con la deteccion de objetos #5

StillOnIt opened this issue Sep 13, 2023 · 5 comments

Comments

@StillOnIt
Copy link

Cuando uso el código obtengo el siguiente error:


RuntimeError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_9920/3701537150.py in
1 # instanciamos al modelo
----> 2 yolo = YOLO(input_size = tamanio,
3 labels = labels,
4 max_box_per_image = 30,#poner numero de elementos max que se pueden encontrar en una imagen
5 anchors = anchors)

~\AppData\Local\Temp/ipykernel_9920/3061781346.py in init(self, input_size, labels, max_box_per_image, anchors)
21 self.feature_extractor = FullYoloFeature(self.input_size)
22
---> 23 print(self.feature_extractor.get_output_shape())
24 self.grid_h, self.grid_w = self.feature_extractor.get_output_shape()
25 features = self.feature_extractor.extract(input_image)

~\AppData\Local\Temp/ipykernel_9920/1111685552.py in get_output_shape(self)
22
23 def get_output_shape(self):
---> 24 print(self.feature_extractor.get_output_shape_at(-1)[1:3])
25 return self.feature_extractor.get_output_shape_at(-1)[1:3]
26

~\anaconda3\lib\site-packages\keras\engine\base_layer.py in get_output_shape_at(self, node_index)
2091 RuntimeError: If called in Eager mode.
2092 """
-> 2093 return self._get_node_attribute_at_index(node_index, 'output_shapes',
2094 'output shape')
2095

~\anaconda3\lib\site-packages\keras\engine\base_layer.py in _get_node_attribute_at_index(self, node_index, attr, attr_name)
2699 """
2700 if not self._inbound_nodes:
-> 2701 raise RuntimeError(f'The layer {self.name} has never been called '
2702 'and thus has no defined {attr_name}.')
2703 if not len(self._inbound_nodes) > node_index:

RuntimeError: The layer model_24 has never been called and thus has no defined {attr_name}.

Para poder usar el código he tenido que adaptar la función "leer_annotations" para que en vez de xml leyera el json de cada imagen.

@jbagnato
Copy link
Owner

jbagnato commented Sep 13, 2023 via email

@StillOnIt
Copy link
Author

Me sigue dando error, pero esta vez el error es el siguiente:

RuntimeError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_14212/3701537150.py in
1 # instanciamos al modelo
----> 2 yolo = YOLO(input_size = tamanio,
3 labels = labels,
4 max_box_per_image = 30,#poner numero de elementos max que se pueden encontrar en una imagen
5 anchors = anchors)

~\AppData\Local\Temp/ipykernel_14212/3061781346.py in init(self, input_size, labels, max_box_per_image, anchors)
21 self.feature_extractor = FullYoloFeature(self.input_size)
22
---> 23 print(self.feature_extractor.get_output_shape())
24 self.grid_h, self.grid_w = self.feature_extractor.get_output_shape()
25 features = self.feature_extractor.extract(input_image)

~\AppData\Local\Temp/ipykernel_14212/1252490487.py in get_output_shape(self)
25
26 def get_output_shape(self):
---> 27 return self.feature_extractor.get_output_shape_at(-1)[1:3]
28
29 def extract(self, input_image):

~\anaconda3\lib\site-packages\keras\engine\base_layer_v1.py in get_output_shape_at(self, node_index)
1483 RuntimeError: If called in Eager mode.
1484 """
-> 1485 return self._get_node_attribute_at_index(node_index, 'output_shapes',
1486 'output shape')
1487

~\anaconda3\lib\site-packages\keras\engine\base_layer_v1.py in _get_node_attribute_at_index(self, node_index, attr, attr_name)
2038 """
2039 if not self._inbound_nodes:
-> 2040 raise RuntimeError('The layer has never been called '
2041 'and thus has no defined ' + attr_name + '.')
2042 if not len(self._inbound_nodes) > node_index:

RuntimeError: The layer has never been called and thus has no defined output shape.

@jbagnato
Copy link
Owner

jbagnato commented Sep 13, 2023 via email

@StillOnIt
Copy link
Author

Si, el error se sigue dando por el siguiente paso self.grid_h, self.grid_w = self.feature_extractor.get_output_shape()

@jbagnato
Copy link
Owner

jbagnato commented Sep 13, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants