Скачать книгу

= []

      # Обработка выходных данных нейронной сети

      for out in outs:

      for detection in out:

      scores = detection[5:]

      class_id = np.argmax(scores)

      confidence = scores[class_id]

      if confidence > 0.5:

      # Параметры ограничивающего прямоугольника

      center_x = int(detection[0] * width)

      center_y = int(detection[1] * height)

      w = int(detection[2] * width)

      h = int(detection[3] * height)

      x = int(center_x – w / 2)

      y = int(center_y – h / 2)

      boxes.append([x, y, w, h])

      confidences.append(float(confidence))

      class_ids.append(class_id)

      # Отображение результатов

      for i in range(len(boxes)):

      x, y, w, h = boxes[i]

      label = str(classes[class_ids[i]])

      confidence = confidences[i]

      color = (0,255,0)

      cv2.rectangle(image, (x, y), (x + w, y + h), color, 2)

      cv2.putText(image, label + " " + str(round(confidence, 2)), (x, y – 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, color, 2)

      # Отображение изображения с обнаруженными объектами

      cv2.imshow("Object Detection", image)

      cv2.waitKey(0)

      cv2.destroyAllWindows()

      ```

      Примечание:

      – Вам нужно иметь предварительно обученную модель (например, YOLO) и файл с классами объектов (например, coco.names).

      Конец ознакомительного фрагмента.

      Текст предоставлен ООО «Литрес».

      Прочитайте эту книгу целиком, купив полную легальную версию на Литрес.

      Безопасно оплатить книгу можно банковской картой Visa, MasterCard, Maestro, со счета мобильного телефона, с платежного терминала, в салоне МТС или Связной, через PayPal, WebMoney, Яндекс.Деньги, QIWI Кошелек, бонусными картами или другим удобным Вам способом.

/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wgARCAhhBdwDASIAAhEBAxEB/8QAGwABAAIDAQEAAAAAAAAAAAAAAAQFAQIDBgf/xAAaAQEAAwEBAQAA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