mmaaz60 / mvits_for_class_agnostic_od

[ECCV'22] Official repository of paper titled "Class-agnostic Object Detection with Multi-modal Transformer".

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Need to understand how to import weights

abhi-vellala opened this issue · comments

Hello,

Firstly, I'd like to congratulate you for bringing this amazing work. Class agnostic object detection is much needed currently in the industry and this would be a great way to solve the problem.

I wanted to test your model on some custom data. However, I cannot import pre-trained weights from the link you have provided. I can see the zip file but I couldn't find a way to import them. I'm using OpenCV to import weights. It is asking me to have a config file as well as .weights file.

Could you please help me which library to use to import weights when I'm working on a jupyter notebook?

Thank you,

Hi @abhi-vellala,

Thank you for your interest in our work. You can use the script inference/main.py to test our MDef-DETR model on your custom dataset. Please follow the steps below,

  1. Clone the repository and set the PYTHONPATH environment variable
git clone https://github.com/mmaaz60/mvits_for_class_agnostic_od.git
cd mvits_for_class_agnostic_od
export PYTHONPATH="./:$PYTHONPATH"
  1. Download the pre-trained weights pretrained_models/MDef_DETR_r101_epoch20.pth
  2. Run the script as
python inference/main.py -m mdef_detr -i <path to directory containing custom dataset images> -c <path to the downloaded MDef-DETR weights file> -tq 'all objects'

The script will save the class-agnostic detections in .pkl format at the same path containing your custom dataset images directory. The .pkl file contains a dictionary with keys as image names and values as the tuple of predicted boxes & scores (i.e. ([boxes], [scores])). You can also save the predictions in .txt file using SaveTxtFormat class in main.py from save_predictions.py.

Additionally, you can run python inference/main.py -h to see the complete usage of the script. Moreover, you can try using different general or targeted queries using the flag -tq. For example, -tq 'all visible entities and objects', -tq 'all salient objects', etc.

I hope it will help. Let me know if you have any questions.

Hi,

Feel free to reopen if you have any confusion.