аргумент должен быть строкой или числом - PullRequest
0 голосов
/ 16 мая 2018

Я получил это сообщение об ошибке через 10 секунд после запуска сценария.

Аргумент int () должен быть строкой, байтовоподобным объектом или числом, а не NoneType

Не могли бы вы объяснить мне это сообщение об ошибке и помочь мне решить эту проблему. Я использую tenorflow версии 1.8 cv2 версии 3.4.0

Заранее спасибо!

Мой код

video = cv2.VideoCapture('rtsp://10.10.10.10/h264.sdp?res=half&x0=0&y0=0&x1=1920&y1=1080&qp=20&ratelimit=10000&doublescan=0&ssn=16026')
ret = video.set(3,1280)
ret = video.set(4,720)


while(True):
    try:
        # Acquire frame and expand frame dimensions to have shape: [1, None, None, 3]
        # i.e. a single-column array, where each item in the column has the pixel RGB value
        #frame = cameraDevice.get_frame()
        ret, frame = video.read()
        frame_expanded = np.expand_dims(frame, axis=0)

        # Perform the actual detection by running the model with the image as input
        (boxes, scores, classes, num) = sess.run(
            [detection_boxes, detection_scores, detection_classes, num_detections],
            feed_dict={image_tensor: frame_expanded})

        # Draw the results of the detection (aka 'visulaize the results')
        vis_util.visualize_boxes_and_labels_on_image_array(
            frame,
            np.squeeze(boxes),
            np.squeeze(classes).astype(np.int32),
            np.squeeze(scores),
            category_index,
            use_normalized_coordinates=True,
            line_thickness=4,
            min_score_thresh=0.85)

        # All the results have been drawn on the frame, so it's time to display it.
        cv2.imshow('Object detector', frame)
    except Exception as exc:
        print(exc)

    # Press 'q' to quit
    if cv2.waitKey(1) == ord('q'):
        break

# Clean up
video.release()
cv2.destroyAllWindows()
...