roboflow / notebooks

Examples and tutorials on using SOTA computer vision models and techniques. Learn everything from old-school ResNet, through YOLO and object-detection transformers like DETR, to the latest models like Grounding DINO and SAM.
https://roboflow.com/models
4.78k stars 744 forks source link

DETR Notebook "Name Error Image_Processor is not defined" #196

Open Satyajit1993 opened 10 months ago

Satyajit1993 commented 10 months ago

After running this block, I am getting "Name Error image_processor is not defined"

TRAIN_DATASET = CocoDetection(image_directory_path=TRAIN_DIRECTORY, image_processor=image_processor, train=True) VAL_DATASET = CocoDetection(image_directory_path=VAL_DIRECTORY, image_processor=image_processor, train=False) TEST_DATASET = CocoDetection(image_directory_path=TEST_DIRECTORY, image_processor=image_processor, train=False)

Kindly Help

github-actions[bot] commented 10 months ago

👋 Hello @Satyajit1993, thank you for leaving an issue on Roboflow Notebooks.

🐞 Bug reports

If you are filing a bug report, please be as detailed as possible. This will help us more easily diagnose and resolve the problem you are facing. To learn more about contributing, check out our Contributing Guidelines.

If you require support with custom code that is not part of Roboflow Notebooks, please reach out on the Roboflow Forum or on the GitHub Discussions page associated with this repository.

💬 Get in touch

Do you have more questions about Roboflow that we haven't responded to yet? Feel free to ask them on the Roboflow Discuss forum. Our developer advocates and community team actively respond to questions there.

To ask questions about Notebooks, head over to the GitHub Discussions section of this repository.

MoAKgit commented 9 months ago

As you are going to use pre-trained DETR from transformers , you can import it like this: from transformers import DetrImageProcessor image_processor = DetrImageProcessor.from_pretrained("facebook/detr-resnet-50")

Hope this helps!

MoAKgit commented 9 months ago

After running this block, I am getting "Name Error image_processor is not defined"

TRAIN_DATASET = CocoDetection(image_directory_path=TRAIN_DIRECTORY, image_processor=image_processor, train=True) VAL_DATASET = CocoDetection(image_directory_path=VAL_DIRECTORY, image_processor=image_processor, train=False) TEST_DATASET = CocoDetection(image_directory_path=TEST_DIRECTORY, image_processor=image_processor, train=False)

Kindly Help

As you are going to use pre-trained DETR from transformers , you can import it like this: from transformers import DetrImageProcessor image_processor = DetrImageProcessor.from_pretrained("facebook/detr-resnet-50")

Hope this helps!