RuoyuChen10 / objectdetection-saliency-maps

Based on the mmdetection framework, compute various salience maps for object detection.
67 stars 6 forks source link

generate a multiple saliency map for different objects at once #3

Open alaa-shubbak opened 1 year ago

alaa-shubbak commented 1 year ago

Hello ,

I am interested to know how can i generate the saliency map for multiple object in one image.

I know how to find a saliency map only for one object in the image , but i don't know how to make that for multiple objects (either from same category or different categories) .

I noticed that you mentioned that you can do it on this repository , Can you help me please?

RuoyuChen10 commented 1 year ago

Hello ,

I am interested to know how can i generate the saliency map for multiple object in one image.

I know how to find a saliency map only for one object in the image , but i don't know how to make that for multiple objects (either from same category or different categories) .

I noticed that you mentioned that you can do it on this repository , Can you help me please?

For D-RISE, since the feedback is global, the saliency map corresponding to an object should also be global, not in-box. You can refer the file drise-yolov3.ipynb.

target_box = np.array([354, 177, 390, 235])
target_box = target_box.astype(int)
saliency_map = generate_saliency_map(image,
                                     target_class_index=1,
                                     target_box=target_box,
                                     prob_thresh=0.5,
                                     grid_size=(16, 16),
                                     n_masks=1000)

image_with_bbox = image.copy()
cv2.rectangle(image_with_bbox, tuple(target_box[:2]), tuple(target_box[2:]),
              (0, 255, 0), 5)
plt.figure(figsize=(7, 7))
plt.imshow(image_with_bbox[:, :, ::-1])
plt.imshow(saliency_map, cmap='jet', alpha=0.5)
plt.axis('off')
plt.show()

you can use detector to detect multi boxes, and input these detection boxes into the calculation in turn.

alaa-shubbak commented 1 year ago

thanks , I will try it.

RuoyuChen10 commented 1 year ago

Hello ,

I am interested to know how can i generate the saliency map for multiple object in one image.

I know how to find a saliency map only for one object in the image , but i don't know how to make that for multiple objects (either from same category or different categories) .

I noticed that you mentioned that you can do it on this repository , Can you help me please?

I just release the Grad-CAM of Faster R-CNN, you can have a look, it may closer to what you describe.