tensorflow / models

Models and examples built with TensorFlow
Other
77.18k stars 45.76k forks source link

Bounding box coordinates via video object detection #4682

Closed alvinxiii closed 6 years ago

alvinxiii commented 6 years ago

Is it possible to get the coordinates of the detected object through video object detection? For example, topleft, bottomright coordinates.

code :

with detection_graph.as_default():
  with tf.Session(graph=detection_graph) as sess:
    while True:
      ret, image_np = cap.read()
      stime = time.time()
      # Expand dimensions since the model expects images to have shape: [1, None, None, 3]
      image_np_expanded = np.expand_dims(image_np, axis=0)
      image_tensor = detection_graph.get_tensor_by_name('image_tensor:0')
      # Each box represents a part of the image where a particular object was detected.
      boxes = detection_graph.get_tensor_by_name('detection_boxes:0')
      # Each score represent how level of confidence for each of the objects.
      # Score is shown on the result image, together with the class label.
      scores = detection_graph.get_tensor_by_name('detection_scores:0')
      classes = detection_graph.get_tensor_by_name('detection_classes:0')
      num_detections = detection_graph.get_tensor_by_name('num_detections:0')
      print (classes)
      (left, right, top, bottom) = (xmin * im_width, xmax * im_width, ymin * im_height, ymax * im_height)
      # Actual detection.
      (boxes, scores, classes, num_detections) = sess.run(
          [boxes, scores, classes, num_detections],
          feed_dict={image_tensor: image_np_expanded})
      # Visualization of the results of a detection.
      vis_util.visualize_boxes_and_labels_on_image_array(
          image_np,
          np.squeeze(boxes),
          np.squeeze(classes).astype(np.int32),
          np.squeeze(scores),
          category_index,
          use_normalized_coordinates=True,
          line_thickness=8)
      print('FPS {:.1f}'.format(1 / (time.time() - stime)))
      cv2.imshow('object detection', cv2.resize(image_np, (800,600)))
      if cv2.waitKey(25) & 0xFF == ord('q'):
        cv2.destroyAllWindows()
        break
alvinxiii commented 6 years ago

where should I put? Its not working

SpiralBeing commented 6 years ago
  ymin = int((boxes[0][0][0]*height))
  xmin = int((boxes[0][0][1]*width))
  ymax = int((boxes[0][0][2]*height))
  xmax = int((boxes[0][0][3]*width))

  Result = np.array(img_np[ymin:ymax,xmin:xmax])

You need put it after vis_util.visualize_boxes_and_labels_on_image_array block

k-w-w commented 6 years ago

For future reference, this question is better asked on StackOverflow since it is not a bug or feature request. There is also a larger community that reads questions there.

If you think we've misinterpreted a bug, please comment again with a clear explanation, as well as all of the information requested in the issue template. Thanks!

LyonOconner commented 6 years ago
  ymin = int((boxes[0][0][0]*height))
  xmin = int((boxes[0][0][1]*width))
  ymax = int((boxes[0][0][2]*height))
  xmax = int((boxes[0][0][3]*width))

  Result = np.array(img_np[ymin:ymax,xmin:xmax])

You need put it after vis_util.visualize_boxes_and_labels_on_image_array block

& extract image detected 🤓 img_item = "imagename.png" cv2.imwrite(img_item, Result)

manoj652 commented 5 years ago

box = np.squeeze(boxes) for i in range(len(boxes)): ymin = (int(box[i,0]height)) xmin = (int(box[i,1]width)) ymax = (int(box[i,2]height)) xmax = (int(box[i,3]width)) print(ymin,xmin,ymax,xmax) roi =image[ymin:ymax,xmin:xmax].copy()

KALJSXHN commented 5 years ago
  ymin = int((boxes[0][0][0]*height))
  xmin = int((boxes[0][0][1]*width))
  ymax = int((boxes[0][0][2]*height))
  xmax = int((boxes[0][0][3]*width))

  Result = np.array(img_np[ymin:ymax,xmin:xmax])

You need put it after vis_util.visualize_boxes_and_labels_on_image_array block

& extract image detected nerd_face img_item = "imagename.png" cv2.imwrite(img_item, Result)

hello I need your help. I'm getting error like

name 'boxes' is not defined

manoj652 commented 5 years ago
  ymin = int((boxes[0][0][0]*height))
  xmin = int((boxes[0][0][1]*width))
  ymax = int((boxes[0][0][2]*height))
  xmax = int((boxes[0][0][3]*width))

  Result = np.array(img_np[ymin:ymax,xmin:xmax])

You need put it after vis_util.visualize_boxes_and_labels_on_image_array block

& extract image detected nerd_face img_item = "imagename.png" cv2.imwrite(img_item, Result)

hello I need your help. I'm getting error like

name 'boxes' is not defined

u need xmin,ymin and xmax,ymax

boxes[0][0][0]*height why is this for

use this ymin = (int(box[i,0]*height)) format

KALJSXHN commented 5 years ago
  ymin = int((boxes[0][0][0]*height))
  xmin = int((boxes[0][0][1]*width))
  ymax = int((boxes[0][0][2]*height))
  xmax = int((boxes[0][0][3]*width))

  Result = np.array(img_np[ymin:ymax,xmin:xmax])

You need put it after vis_util.visualize_boxes_and_labels_on_image_array block

& extract image detected nerd_face img_item = "imagename.png" cv2.imwrite(img_item, Result)

hello I need your help. I'm getting error like name 'boxes' is not defined

u need xmin,ymin and xmax,ymax

boxes[0][0][0]*height why is this for

use this ymin = (int(box[i,0]*height)) format sir I just used the format as suggested by you. I'm getting following error: object of type 'Tensor' has no len() for this line for i in range(len(boxes)): Initially i was facing a error :: boxes is not defined So i defined boxes as :: boxes = detection_graph.get_tensor_by_name('detection_boxes:0') please let me know a way out to rectify this problem

KALJSXHN commented 5 years ago

sir sir I just used the format as suggested by you. I'm getting following error: object of type 'Tensor' has no len() for this line for i in range(len(boxes)): Initially i was facing a error :: boxes is not defined So i defined boxes as :: boxes = detection_graph.get_tensor_by_name('detection_boxes:0') please let me know a way out to rectify this problem

If possible, can you mail me the source code document for object detection with coordinates of object

On Tue, 4 Jun 2019 at 13:55, Vasi Manoj notifications@github.com wrote:

ymin = int((boxes[0][0][0]height)) xmin = int((boxes[0][0][1]width)) ymax = int((boxes[0][0][2]height)) xmax = int((boxes[0][0][3]width))

Result = np.array(img_np[ymin:ymax,xmin:xmax])

You need put it after vis_util.visualize_boxes_and_labels_on_image_array block

& extract image detected nerd_face img_item = "imagename.png" cv2.imwrite(img_item, Result)

hello I need your help. I'm getting error like

name 'boxes' is not defined

u need xmin,ymin and xmax,ymax

boxes[0][0][0]*height why is this for

use this ymin = (int(box[i,0]*height)) format

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tensorflow/models/issues/4682?email_source=notifications&email_token=AMH2EMYUI76BPD5VRNQOTADPYYRHVA5CNFSM4FIBM7B2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODW3Z4NQ#issuecomment-498572854, or mute the thread https://github.com/notifications/unsubscribe-auth/AMH2EMYTCXWYYSQFB5YDB73PYYRHVANCNFSM4FIBM7BQ .

manoj652 commented 5 years ago

bbbox check the png

KALJSXHN commented 5 years ago

My code page is totally different could you mail me the code file.

On Tue, 4 Jun 2019 at 15:40, Vasi Manoj notifications@github.com wrote:

[image: bbbox] https://user-images.githubusercontent.com/22527200/58870872-9c9e6a00-86de-11e9-8645-5481dc5a79b9.png check the png

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tensorflow/models/issues/4682?email_source=notifications&email_token=AMH2EM3HUPWRGWTAM5YAU6TPYY5PPA5CNFSM4FIBM7B2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODW4CT6A#issuecomment-498608632, or mute the thread https://github.com/notifications/unsubscribe-auth/AMH2EMYZZBHG4HEL5ZVRYRTPYY5PPANCNFSM4FIBM7BQ .

ebinzacharias commented 5 years ago
  ymin = int((boxes[0][0][0]*height))
  xmin = int((boxes[0][0][1]*width))
  ymax = int((boxes[0][0][2]*height))
  xmax = int((boxes[0][0][3]*width))

  Result = np.array(img_np[ymin:ymax,xmin:xmax])

You need put it after vis_util.visualize_boxes_and_labels_on_image_array block

& extract image detected nerd_face img_item = "imagename.png" cv2.imwrite(img_item, Result)

hello I need your help. I'm getting error like

name 'boxes' is not defined

Also, this can solve your problem. boxes = output_dict['detection_boxes']

ifouiteh commented 5 years ago

bbbox check the png

Hello,

I have the same code as you, but it tells me name height is not defined. Could you help me please ? I'm new o programming.

ebinzacharias commented 5 years ago

bbbox check the png

Hello,

I have the same code as you, but it tells me name height is not defined. Could you help me please ? I'm new o programming.

Hello,

I guess you wouldnt have given the input image dimensions.

width, height = image.shape[:2]

You should mention this line before. Hope this helps !!

ifouiteh commented 5 years ago

bbbox check the png

Hello, I have the same code as you, but it tells me name height is not defined. Could you help me please ? I'm new o programming.

Hello,

I guess you wouldnt have given the input image dimensions.

width, height = image.shape[:2]

You should mention this line before. Hope this helps !!

Yes it did, thank you very much. image

But i'm not sure if the coordinates i have got matches the number of bounding boxes i have in my image.

hiteshreddy95 commented 5 years ago

Hello,

I need someone to help me, i want to extract the actual coordinates of the detected objects along with their class. But the coordinates which i'm getting are normalized values. is there any way to get the actual coordinates?

ebinzacharias commented 5 years ago

Hello,

I need someone to help me, i want to extract the actual coordinates of the detected objects along with their class. But the coordinates which i'm getting are normalized values. is there any way to get the actual coordinates?

Hello,

you can take the bounding box, BBOX = ymin, xmin, ymax, xmax

Then multiply with the width and height of the image. final_box = ymin X width, xmin X height, ymax X width, xmax X height

Hope it helps !!

hiteshreddy95 commented 5 years ago

Hello @ebinzacharias ,

Can you please share me your code?. Because, i need to calculate mAP (mean average precision) for evaluation purpose. And i'm sharing normalized cordinates which i am getting. Capture

ebinzacharias commented 5 years ago

Hello @ebinzacharias ,

Can you please share me your code?. Because, i need to calculate mAP (mean average precision) for evaluation purpose. And i'm sharing normalized cordinates which i am getting. Capture

Hi,

Take, bboxes = boxes[scores > min_score_thresh] width, height = image.shape[:2] final_box = [] for box in bboxes: ymin, xmin, ymax, xmax = box final_box = [int(ymin width), int(xmin height), int(ymax width), int(xmax height)]

Try this way.

hiteshreddy95 commented 5 years ago

Hello,

I have a problem in evaluating my object detection model. The ground truth which i have is completely different from the predicted truth, i mean the xmin, ymin, xmax and ymax and completely different. Someone help me!!!

Ground Truth: xmin>112.7490234375, ymin>17.1455078125, xmax>277.3284606933594, ymax>167.75123596191406 xmin>6.78125, ymin>6.27734375, xmax>87.906494140625, ymax>154.94227600097656

Predicted Truth: array([0.03908414, 0.01921505, 0.8721036 , 0.3157735 ] array([0.10951501, 0.4028356 , 0.9246461 , 0.97304785].

How to get the coordinates in similar format of ground truth from the model?

ashaffir commented 5 years ago

Hi all, I have an image with two detected boxes. I am trying to extract those two boxes, but the boxes array contains only one box. To clarify: I am seeing that the model detects and marks the two boxes on the original image, but when I am trying to follow the instructions above (for extracting those two boxes), I am able to extract only one. Can anybody explain to me please, why is that?

ebinzacharias commented 5 years ago

Hi @hiteshreddy95 @ashaffir ,

Did you try this ?

Hello @ebinzacharias , Can you please share me your code?. Because, i need to calculate mAP (mean average precision) for evaluation purpose. And i'm sharing normalized cordinates which i am getting. Capture

Hi,

Take, bboxes = boxes[scores > min_score_thresh] width, height = image.shape[:2] final_box = [] for box in bboxes: ymin, xmin, ymax, xmax = box final_box = [int(ymin width), int(xmin height), int(ymax width), int(xmax height)]

Try this way.

ebinzacharias commented 5 years ago

Hi @hiteshreddy95 @ashaffir ,

Did you try this ?

Hello @ebinzacharias , Can you please share me your code?. Because, i need to calculate mAP (mean average precision) for evaluation purpose. And i'm sharing normalized cordinates which i am getting. Capture

Hi, Take, bboxes = boxes[scores > min_score_thresh] width, height = image.shape[:2] final_box = [] for box in bboxes: ymin, xmin, ymax, xmax = box final_box = [int(ymin width), int(xmin height), int(ymax width), int(xmax height)] Try this way.

Also, take the box coordinates first from output_dict['detection_boxes'].

For instance,

boxes = output_dict['detection_boxes'] for i in range(min(max_boxes_to_draw, boxes.shape[0])): -----if scores is None or scores[i] > min_score_thresh: ----------class_name = category_index[output_dict['detection_classes'][i]]['name']

you can get the boxes and class afterwards !

ashaffir commented 5 years ago

Excellent!! Thanks

ifouiteh commented 4 years ago

Hello, thank you for your interactions everyone. I need some help in here too, My model in Tensorflow is able to detect all the objects windows in my case, but it does not draw all the corresponding boxes (I know it detects all because when i extract coordinates, it gives me coordinates of all the windows in the façade) image

Does enyone have any idea ? Thanks in advance!

ebinzacharias commented 4 years ago

Hello, thank you for your interactions everyone. I need some help in here too, My model in Tensorflow is able to detect all the objects windows in my case, but it does not draw all the corresponding boxes (I know it detects all because when i extract coordinates, it gives me coordinates of all the windows in the façade) image

Does enyone have any idea ? Thanks in advance!

Hello,

It seems like it draws 20 bounding boxes as per your image. This is a preset value for Tensorflow object detection API.

So change it to either None or the required number ! Changing it to None, will show all the detected bounding boxes.

Edit the File: visualization_utils.py

Path = models/research/object_detection/utils/visualization_utils.py look for "max_boxes_to_draw"

Hope it helps !

ifouiteh commented 4 years ago

Hello, thank you for your interactions everyone. I need some help in here too, My model in Tensorflow is able to detect all the objects windows in my case, but it does not draw all the corresponding boxes (I know it detects all because when i extract coordinates, it gives me coordinates of all the windows in the façade) image Does enyone have any idea ? Thanks in advance!

Hello,

It seems like it draws 20 bounding boxes as per your image. This is a preset value for Tensorflow object detection API.

So change it to either None or the required number ! Changing it to None, will show all the detected bounding boxes.

Edit the File: visualization_utils.py

Path = models/research/object_detection/utils/visualization_utils.py look for "max_boxes_to_draw"

Hope it helps !

Hi, thank you for the answer, even though it looked so logical and correct it didnt work...it's like nothing changed when i changed the max boxes to draw number, unfornately

ebinzacharias commented 4 years ago

Hello, thank you for your interactions everyone. I need some help in here too, My model in Tensorflow is able to detect all the objects windows in my case, but it does not draw all the corresponding boxes (I know it detects all because when i extract coordinates, it gives me coordinates of all the windows in the façade) image Does enyone have any idea ? Thanks in advance!

Hello, It seems like it draws 20 bounding boxes as per your image. This is a preset value for Tensorflow object detection API. So change it to either None or the required number ! Changing it to None, will show all the detected bounding boxes. Edit the File: visualization_utils.py Path = models/research/object_detection/utils/visualization_utils.py look for "max_boxes_to_draw" Hope it helps !

Hi, thank you for the answer, even though it looked so logical and correct it didnt work...it's like nothing changed when i changed the max boxes to draw number, unfornately

Hello,

Which visualisation drawing function are you using?

Also in which function did you change the value ?

Did you check that ??

ifouiteh commented 4 years ago

Hello, thank you for your interactions everyone. I need some help in here too, My model in Tensorflow is able to detect all the objects windows in my case, but it does not draw all the corresponding boxes (I know it detects all because when i extract coordinates, it gives me coordinates of all the windows in the façade) image Does enyone have any idea ? Thanks in advance!

Hello, It seems like it draws 20 bounding boxes as per your image. This is a preset value for Tensorflow object detection API. So change it to either None or the required number ! Changing it to None, will show all the detected bounding boxes. Edit the File: visualization_utils.py Path = models/research/object_detection/utils/visualization_utils.py look for "max_boxes_to_draw" Hope it helps !

Hi, thank you for the answer, even though it looked so logical and correct it didnt work...it's like nothing changed when i changed the max boxes to draw number, unfornately

Hello,

Which visualisation drawing function are you using?

Also in which function did you change the value ?

Did you check that ??

I changed in the function in the photo. What do you mean by drawing function ? image

ebinzacharias commented 4 years ago

Hello, thank you for your interactions everyone. I need some help in here too, My model in Tensorflow is able to detect all the objects windows in my case, but it does not draw all the corresponding boxes (I know it detects all because when i extract coordinates, it gives me coordinates of all the windows in the façade) image Does enyone have any idea ? Thanks in advance!

Hello, It seems like it draws 20 bounding boxes as per your image. This is a preset value for Tensorflow object detection API. So change it to either None or the required number ! Changing it to None, will show all the detected bounding boxes. Edit the File: visualization_utils.py Path = models/research/object_detection/utils/visualization_utils.py look for "max_boxes_to_draw" Hope it helps !

Hi, thank you for the answer, even though it looked so logical and correct it didnt work...it's like nothing changed when i changed the max boxes to draw number, unfornately

Hello, Which visualisation drawing function are you using? Also in which function did you change the value ? Did you check that ??

I changed in the function in the photo. What do you mean by drawing function ? image

As you can see this is the function to draw bounding boxes on image tensors.

In your main code, which function are you calling for drawing the bounding boxes? Check that and change the value in the corresponding function in the util file.

If you havent changed anything, then you must be using "visualize_boxes_and_labels_on_image_array".

Then check for this function and change it there !!!

ifouiteh commented 4 years ago

Hello, thank you for your interactions everyone. I need some help in here too, My model in Tensorflow is able to detect all the objects windows in my case, but it does not draw all the corresponding boxes (I know it detects all because when i extract coordinates, it gives me coordinates of all the windows in the façade) image Does enyone have any idea ? Thanks in advance!

Hello, It seems like it draws 20 bounding boxes as per your image. This is a preset value for Tensorflow object detection API. So change it to either None or the required number ! Changing it to None, will show all the detected bounding boxes. Edit the File: visualization_utils.py Path = models/research/object_detection/utils/visualization_utils.py look for "max_boxes_to_draw" Hope it helps !

Hi, thank you for the answer, even though it looked so logical and correct it didnt work...it's like nothing changed when i changed the max boxes to draw number, unfornately

Hello, Which visualisation drawing function are you using? Also in which function did you change the value ? Did you check that ??

I changed in the function in the photo. What do you mean by drawing function ? image

As you can see this is the function to draw bounding boxes on image tensors.

In your main code, which function are you calling for drawing the bounding boxes? Check that and change the value in the corresponding function in the util file.

If you havent changed anything, then you must be using "visualize_boxes_and_labels_on_image_array".

Then check for this function and change it there !!!

BLESS YOU! It worked, thank you :)

ebinzacharias commented 4 years ago

Hello, thank you for your interactions everyone. I need some help in here too, My model in Tensorflow is able to detect all the objects windows in my case, but it does not draw all the corresponding boxes (I know it detects all because when i extract coordinates, it gives me coordinates of all the windows in the façade) image Does enyone have any idea ? Thanks in advance!

Hello, It seems like it draws 20 bounding boxes as per your image. This is a preset value for Tensorflow object detection API. So change it to either None or the required number ! Changing it to None, will show all the detected bounding boxes. Edit the File: visualization_utils.py Path = models/research/object_detection/utils/visualization_utils.py look for "max_boxes_to_draw" Hope it helps !

Hi, thank you for the answer, even though it looked so logical and correct it didnt work...it's like nothing changed when i changed the max boxes to draw number, unfornately

Hello, Which visualisation drawing function are you using? Also in which function did you change the value ? Did you check that ??

I changed in the function in the photo. What do you mean by drawing function ? image

As you can see this is the function to draw bounding boxes on image tensors. In your main code, which function are you calling for drawing the bounding boxes? Check that and change the value in the corresponding function in the util file. If you havent changed anything, then you must be using "visualize_boxes_and_labels_on_image_array". Then check for this function and change it there !!!

BLESS YOU! It worked, thank you :)

Great :))

Happy to know !!

ashwath1295 commented 4 years ago

I am not able to extract the multiple coordinates of the bounding boxes by using the below code can someone help me how to extract multiple coordinates?

width, height= image_np.shape[:2]

box = np.squeeze(boxes) for i in range(len(boxes)): ymin = (int(box[i, 0] height)) xmin = (int(box[i, 1] width)) ymax = (int(box[i, 2] height)) xmax = (int(box[i, 3] width))

print(ymin,xmin,ymax,xmax) roi = image_np[ymin:ymax, xmin:xmax].copy()

ashwath1295 commented 4 years ago

Hi @hiteshreddy95 @ashaffir ,

Did you try this ?

Hello @ebinzacharias , Can you please share me your code?. Because, i need to calculate mAP (mean average precision) for evaluation purpose. And i'm sharing normalized cordinates which i am getting. Capture

Hi, Take, bboxes = boxes[scores > min_score_thresh] width, height = image.shape[:2] final_box = [] for box in bboxes: ymin, xmin, ymax, xmax = box final_box = [int(ymin width), int(xmin height), int(ymax width), int(xmax height)] Try this way.

I am using the below code and i am getting an error

image

I am getting an error

image

can someone help me with this?

ifouiteh commented 4 years ago

Hi @hiteshreddy95 @ashaffir , Did you try this ?

Hello @ebinzacharias , Can you please share me your code?. Because, i need to calculate mAP (mean average precision) for evaluation purpose. And i'm sharing normalized cordinates which i am getting. Capture

Hi, Take, bboxes = boxes[scores > min_score_thresh] width, height = image.shape[:2] final_box = [] for box in bboxes: ymin, xmin, ymax, xmax = box final_box = [int(ymin width), int(xmin height), int(ymax width), int(xmax height)] Try this way.

I am using the below code and i am getting an error

image

I am getting an error

image

can someone help me with this?

hey, this is my code for geeting coordinates and it's working just fine:

height, width = image.shape[:2] box= np.squeeze(boxes) max_boxes_to_draw=box.shape[0] scores=np.squeeze(scores) min_score_thresh=0.5 for i in range (min(max_boxes_to_draw, box.shape[0])): if scores [i] > min_score_thresh: ymin = (int(box[i,0]height)) xmin = (int(box[i,1]width)) ymax = (int(box[i,2]height)) xmax = (int(box[i,3]width)) print (xmin,ymin,xmax,ymax)

I on the other hand have issue in knowing which coordinates belongs to which box, as i have multiple boxes in one image (around 25), Do you have any idea ?

ruzgarkanar commented 4 years ago

hi guys. HELP! How do I measure the distance between the objects I detected on the webcam?

ebrarsahin commented 3 years ago

Hi @hiteshreddy95 @ashaffir , Did you try this ?

Hello @ebinzacharias , Can you please share me your code?. Because, i need to calculate mAP (mean average precision) for evaluation purpose. And i'm sharing normalized cordinates which i am getting. Capture

Hi, Take, bboxes = boxes[scores > min_score_thresh] width, height = image.shape[:2] final_box = [] for box in bboxes: ymin, xmin, ymax, xmax = box final_box = [int(ymin width), int(xmin height), int(ymax width), int(xmax height)] Try this way.

I am using the below code and i am getting an error image I am getting an error image can someone help me with this?

hey, this is my code for geeting coordinates and it's working just fine:

height, width = image.shape[:2] box= np.squeeze(boxes) max_boxes_to_draw=box.shape[0] scores=np.squeeze(scores) min_score_thresh=0.5 for i in range (min(max_boxes_to_draw, box.shape[0])): if scores [i] > min_score_thresh: ymin = (int(box[i,0]height)) xmin = (int(box[i,1]width)) ymax = (int(box[i,2]height)) xmax = (int(box[i,3]width)) print (xmin,ymin,xmax,ymax)

I on the other hand have issue in knowing which coordinates belongs to which box, as i have multiple boxes in one image (around 25), Do you have any idea ?

Did you find any solution ?