Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not getting results #31

Open
charul15 opened this issue Jan 10, 2024 · 7 comments
Open

Not getting results #31

charul15 opened this issue Jan 10, 2024 · 7 comments

Comments

@charul15
Copy link

charul15 commented Jan 10, 2024

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?

@mmaaz60
Copy link
Owner

mmaaz60 commented Jan 10, 2024

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

@charul15
Copy link
Author

I tried with conf score 0.7 , getting the same result

@mmaaz60
Copy link
Owner

mmaaz60 commented Jan 10, 2024

Hi @charul15,

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

@charul15
Copy link
Author

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

@mmaaz60
Copy link
Owner

mmaaz60 commented Jan 10, 2024

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.

@charul15
Copy link
Author

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

@mmaaz60
Copy link
Owner

mmaaz60 commented Jan 12, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants