Add Relation DETR - #34900
Conversation
7867221 to
1f0465c
Compare
37959ac to
d114fc7
Compare
|
Hi @xiuqhou! Congratulations on the paper, awesome work! And thanks for working on transformers implementation! Feel free to ping me when it's ready for review or if you have any questions! |
14308cf to
ce63725
Compare
|
Hi @qubvel Thanks for your support! The code is now ready for review—I'd greatly appreciate it if you could take a look and share your feedback. Please let me know if there’s anything that needs improvement. |
|
@ArthurZucker @qubvel @stevhliu Sorry for the late reply! Thanks for your detailed review and suggestions. I have pushed commits according to the reviews except #34900 (comment) about the modular style. CI errors seem not related to changes. |
|
Hey @xiuqhou thanks for working on the PR and opening the issue! I think we can use the following workaround while the issue is not fixed. def get_numpy_to_framework_fn(arr) -> Callable:
"""
Returns a function that converts a numpy array to the framework of the input array.
Args:
arr (`np.ndarray`): The array to convert.
"""
if isinstance(arr, np.ndarray):
return np.array
elif is_torch_available() and is_torch_tensor(arr):
return torch.tensor
else:
raise RuntimeError("...")Let me know if that works for you! |
|
@qubvel thanks for your suggestion! I tried to overwrite the function in I have a question about whether this function is necessary. I searched all the code of |
|
Oh, it might be a redundant function that was copied from one model to another 😄 In that case we can open a separate PR to remove it everywhere |
|
Hi @daniel-bogdoll Sorry for the late reply! As #36208 has been fixed, I have committed code about the modular style for relation-detr. Now I think the PR is fully prepared for review or merge. Please let me know if there are any remaining improvements needed before merging. |
ArthurZucker
left a comment
There was a problem hiding this comment.
Great work isolating the differences! 🤗
Need a comment from @yonigozlan but good otherwise!
| do_resize = self.do_resize if do_resize is None else do_resize | ||
| size = self.size if size is None else size | ||
| size = get_size_dict(size=size, default_to_square=False) | ||
| resample = self.resample if resample is None else resample | ||
| do_rescale = self.do_rescale if do_rescale is None else do_rescale | ||
| rescale_factor = self.rescale_factor if rescale_factor is None else rescale_factor | ||
| do_normalize = self.do_normalize if do_normalize is None else do_normalize | ||
| image_mean = self.image_mean if image_mean is None else image_mean | ||
| image_std = self.image_std if image_std is None else image_std | ||
| do_convert_annotations = ( | ||
| self.do_convert_annotations if do_convert_annotations is None else do_convert_annotations | ||
| ) | ||
| do_pad = self.do_pad if do_pad is None else do_pad | ||
| pad_size = self.pad_size if pad_size is None else pad_size | ||
| format = self.format if format is None else format |
There was a problem hiding this comment.
cc @yonigozlan we don't need these anymore do we?
There was a problem hiding this comment.
This is for the slow image processor so I guess we do...
However @xiuqhou looking at the code for the fast image processor, we can definitely use modular for that too!
Also you should know that we are now prioritizing the use of fast image processors vs slow, so if you could save the checkpoints of this model with a fast image processor that'd be great!
|
Hey, Really promising model and I was wondering if there are any updates on getting this PR merged ? 👀 No rush, just curious about the status. Thanks ! |
What does this PR do?
This PR adds Relation-DETR as introduced in Relation DETR: Exploring Explicit Position Relation Prior for Object Detection. Checkpoint for Relation-DETR (ResNet50) converted from original repo https://github.com/xiuqhou/Relation-DETR has been uploaded to https://huggingface.co/xiuqhou/relation-detr-resnet50
Related issues in original repo:
xiuqhou/Relation-DETR#25
xiuqhou/Relation-DETR#21
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
TODO:
Who can review?
@amyeroberts @qubvel