pixellab: Распознавание на фото по видео
Всем привет! Пытаюсь сделать распознfвание на фото по видео https://www.youtube.com/watch?v=X8-mgyRAr0w&t=122s но получаю ошибку
NotImplementedError: Save or restore weights that is not an instance of
tf.Variable
is not supported in h5, usesave_format='tf'
instead. Got a model or layer Conv2D with weights [<KerasVariable shape=(7, 7, 3, 64), dtype=float32, path=conv1/kernel>, ]
Код:
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"
from pixellib.instance import instance_segmentation
def object_detection_on_an_image():
segment_image = instance_segmentation()
segment_image.load_model(r"C:\Users\Саша\PycharmProjects\TenserFlowTests\mask_rcnn_coco.h5")
target_class = segment_image.select_target_classes(person=True)
result = segment_image.segmentImage(
# image_path="1city.jpg",
# image_path="2cars_people.jpeg",
image_path="3silicon_valley.jpg",
show_bboxes=True,
segment_target_classes=target_class,
# extract_segmented_objects=True,
# save_extracted_objects=True,
output_image_name="output.jpg"
)
# print(result[0]["scores"])
objects_count = len(result[0]["scores"])
print(f"Найдено объектов: {objects_count}")
def main():
object_detection_on_an_image()
if __name__ == '__main__':
main()
Информация:
Версия: python 3.11
Файлы: