Skip to content

Error con la deteccion de objetos #5

@StillOnIt

Description

@StillOnIt

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions