mmaaz60/mvits_for_class_agnostic_od

Not getting results

charul15 opened this issue · 7 comments

I have used the path - MDef_DETR_r101_epoch20.pth to generate open set bboxes using command.
python inference/main.py -c checkpoint/MDef_DETR_r101_epoch20.pth -i data/testdata/ -m mdef_detr -tq 'all objects'

The result i am getting is too poor
Screenshot 2024-01-10 222113

can you please help me
to understand where i am going wrong?

Hi @charul15

Thank you for your interest in our work. The issue is about the confidence threshold. By default the confidence threshold is set to 0 and it will return all 300 bounding boxes corresponding to all 300 queries.

Could you try setting the confidence threshold to a higher value, let's say 0.7 at here?

Thanks

I tried with conf score 0.7 , getting the same result

Hi @charul15,

Please share the image, so that I can check. Thanks

000000000139
Hey , here is the image. Thanks for the help.

Hi @charul15,

The following are the results that I am getting with 0.7 confidence threshold.

image

Steps That I followed

  1. git clone https://github.com/mmaaz60/mvits_for_class_agnostic_od.git
  2. pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 -f https://download.pytorch.org/whl/torch_stable.html
  3. pip install -r requirements.txt
  4. cd models/ops
  5. sh make.sh
  6. cd ../..
  7. export PYTHONPATH="./:$PYTHONPATH"
  8. python inference/main.py -m mdef_detr -i /share/users/maaz/mvits_for_class_agnostic_od/images -c MDef_DETR_r101_epoch20.pth -tq "all objects"

This created a mdef_detr folder in my current directory containing .pkl file (extract all_objects.zip). You can use the following code to plot the results.

import matplotlib.pyplot as plt
import matplotlib.patches as patches
from PIL import Image
import pickle

# Load your image
image_path = "mavl_test.jpg"  # Replace with your image path
pkl_path = "all_objects.pkl"
image = Image.open(image_path)

# Define box coordinates
with open(pkl_path, "rb") as f:
    data = pickle.load(f)
box_coordinates = data['mavl_test'][0]

# Plotting
fig, ax = plt.subplots()
ax.imshow(image)

# Add boxes to the image
for box in box_coordinates:
    x_min, y_min, x_max, y_max = box
    width = x_max - x_min
    height = y_max - y_min
    rect = patches.Rectangle((x_min, y_min), width, height, linewidth=1, edgecolor='r', facecolor='none')
    ax.add_patch(rect)

plt.axis('off')  # Turn off axis labels
plt.show()

Please note that I have modified the line at with the following for setting the threshold to 0.7.

def __init__(self, model, confidence_thresh=0.7):

I hope it will help. Thank You.

thanks for detailed steps. if its possible can you share the model path . The drive path previously mentioned in the other
issues is broken.

thanks for detailed steps. if its possible can you share the model path . The drive path previously mentioned in the other issues is broken.

Hi @charul15,

Can you try this link?

Thanks