detr | End-to-End Object Detection with Transformers | Computer Vision library

 by   facebookresearch Python Version: v0.2 License: Apache-2.0

kandi X-RAY | detr Summary

kandi X-RAY | detr Summary

detr is a Python library typically used in Artificial Intelligence, Computer Vision, Deep Learning, Pytorch, Tensorflow applications. detr has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has medium support. You can install using 'pip install detr' or download it from GitHub, PyPI.

DE⫶TR: End-to-End Object Detection with Transformers.

            kandi-support Support

              detr has a medium active ecosystem.
              It has 11172 star(s) with 2034 fork(s). There are 146 watchers for this library.
              It had no major release in the last 12 months.
              There are 208 open issues and 283 have been closed. On average issues are closed in 29 days. There are 15 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of detr is v0.2

            kandi-Quality Quality

              detr has 0 bugs and 0 code smells.

            kandi-Security Security

              detr has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              detr code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              detr is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              detr releases are available to install and integrate.
              Deployable package is available in PyPI.
              Build file is available. You can build the component from source.
              Installation instructions are not available. Examples and code snippets are available.
              detr saves you 1275 person hours of effort in developing the same functionality from scratch.
              It has 2864 lines of code, 221 functions and 28 files.
              It has medium code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed detr and discovered the below as its top functions. This is intended to give you an instant insight into detr implemented functionality, and help decide if they suit your requirements.
            • Evaluate a model
            • Summarize metrics
            • Combine common COCs
            • Synchronize between two COCs
            • Perform the prediction
            • Resize an image
            • Interpolate input tensor
            • Compute the cost matrices
            • Convert box coordinates to x coordinates
            • Calculates the loss for each box
            • Compute the model
            • Reduce a dictionary
            • Build a model for resnet50
            • Detect resnet101
            • Compute the loss for each label
            • Build a Resnet50 model
            • Build a Resnet101 model
            • Forward the prediction
            • Forward computation
            • Compute the prediction
            • Get argument parser
            • Perform the forward computation
            • Forward the forward projection
            • Train one epoch
            • Compute loss masks
            • Plot log files
            Get all kandi verified functions for this library.

            detr Key Features

            No Key Features are available at this moment for detr.

            detr Examples and Code Snippets

            TensorRT for DETR
            Pythondot img1Lines of Code : 54dot img1License : Permissive (Apache-2.0)
            copy iconCopy
            ├── model  # DETR模型相关的python代码(主要来源[1].
            │   ├──
            │   ├──
            │   ├──  # backbone resnet50
            │   ├──  
            │   ├──    
            TensorRT for DETR,1.Pytorch checkpoint to ONNX
            Pythondot img2Lines of Code : 38dot img2License : Permissive (Apache-2.0)
            copy iconCopy
            # pytorch to onnx
            $ python3 -h
            # batch_size=1, static
            # 在项目下生成detr.onnx和detr_sim.onnx(simplify后的onnx)
            $ python3 --model_dir ./checkpoint/detr_resnet50.pth  --check --onnx_dir ./detr.onnx
            # dynamic shape
            # 在项目下生成det  
            TensorRT for DETR,2.TensorRT Inference in FP32 or FP16 Mode
            Pythondot img3Lines of Code : 35dot img3License : Permissive (Apache-2.0)
            copy iconCopy
            # 提供build engine和反序列化engine进行推断
            # inference_detr_trt.py支持FP32,FP16的build engine和engine的推断,同时支持static shape和Dynamic shape的推断,前处理,后处理和结果可视化,支持INT8量化后engine的推断,包括static shape, dynamic shape及前处理后处理和结果可视化
            # static shape
            # FP32
            $ python3 inference_detr_tr  

            Community Discussions


            POST request to query fastapi using python-requests with a file and other params
            Asked 2022-Mar-09 at 12:27

            Hi (and apologies for the long message)

            I have a use-case that seems fairly common and on which I bang my head.

            I am using FastAPI to serve some ML models and I have a Streamlit basic UI using python-requests.

            One of my service is getting an image through a POST request and it is working like a charm.




            Answered 2022-Mar-09 at 12:27

            To pass query parameters in Python requests, you should use params key instead. Hence:



            Is there any way to change parameters in pretrained DetrFeatureExtractor?
            Asked 2022-Feb-03 at 10:12

            For my model, I load pretrained version of DetrFeatureExtractor:



            Answered 2022-Feb-03 at 10:12

            Your values to the constructor are not taken, because you are calling .from_pretrained(), which loads all values from the respective config file of the pretrained model (in your case, the corresponding config file can be viewed here). Even if some values might not be specified in the config, they will be primarily taken from the default values, instead of whatever you're passing before.

            If you want to change attributes, you can do so after loading:



            ValueError: Unrecognized model in ./MRPC/. Should have a `model_type` key in its config.json, or contain one of the following strings in its name
            Asked 2022-Jan-13 at 14:10

            Goal: Amend this Notebook to work with Albert and Distilbert models

            Kernel: conda_pytorch_p36. I did Restart & Run All, and refreshed file view in working directory.

            Error occurs in Section 1.2, only for these 2 new models.

            For filenames etc., I've created a variable used everywhere:



            Answered 2022-Jan-13 at 14:10

            When instantiating AutoModel, you must specify a model_type parameter in ./MRPC/config.json file (downloaded during Notebook runtime).

            List of model_types can be found here.


            Code that appends model_type to config.json, in the same format:



            Wrong "-1 background" annotations loaded from Custom COCO Dataset using Mmdetection
            Asked 2021-Sep-23 at 15:47

            I'm working using Mmdetection to train a Deformable DETR model using a custom COCO Dataset. Meaning a Custom Dataset using the COCO format of annotations. The dataset uses the same images as the COCO with different "toy" annotations for a "playground" experiment and the annotation file was created using the packages pycocotools and json exclusively.

            I have made five variations of this playground dataset: 2 datasets with three classes (classes 1, 2, and 3), 1 dataset with six classes (classes 1 to 6) and 2 datasets with 7 classes (classes 1 to 7).

            The Problem

            Now, after creating the dataset in mmdetection using mmdet.datasets.build_dataset, I used the following code to check if everything was OK:



            Answered 2021-Sep-23 at 15:47

            There was a mismatch between the classes names in the annotation file and the classes names in the mmdetection config object. Correcting those solved the problem.



            What's the meaning of Optional[Tensor] in Transformer?
            Asked 2021-May-08 at 14:00
                def forward(self, src,
                        mask: Optional[Tensor] = None,
                        src_key_padding_mask: Optional[Tensor] = None,
                        pos: Optional[Tensor] = None):
                output = src


            Answered 2021-May-08 at 13:51

            Optional is used for type hints. Please refer to this from the Python docs.

            Typing was introduced in Python 3.5. It does not affect your run time, but it can be used by IDES, linters, etc to help the programmer see type annotations.

            Basically, it helps you - the programmer - see what type a object is. This will help you reduce bugs and help you manage a large code base.



            Classes in Coco dataset
            Asked 2020-Dec-17 at 13:18

            I have been checking out this detr repository and the total number of classes are 100, but 10 of these are empty string as shown here.
            Is there any particular reason behind this?



            Answered 2020-Dec-17 at 13:18

            Basically, the COCO dataset was described in a paper before its release (you can find it here). At this point, the authors gave a list of the 91 types of objects that would be in the dataset.

            But when the 2014 and 2017 datasets sere released, it turned out that you could find only 80 of these objects in the annotations.

            The list you have is the original list of objects (as described in the paper) but with every object that does not appear in the 2014 and 2017 replaced by the empty string "".

            My guess is that the sole purpose of keeping these "phantom" objects is to keep consistency with object ids that may have been fixed someday in the past.

            If you want to learn more about it, you can look at this blog entry.



            how to use scipy.optimize.linear_sum_assignment in tensorflow or keras?
            Asked 2020-Jul-01 at 09:32

            first time posting here ! If my question is lacking anything please tell me and I'll fix it !

            Facebook recently released DETR, an object detection model using transformers ! The model is implemented with Pytorch and I'm trying to implement the loss function where Hungarian algorithm is involved but with Keras and Tensorflow as a custom loss function for Keras model. In the original implementation from Facebook, it's line 81-82 in

            In order to use numpy and classic python function, I used:



            Answered 2020-Jul-01 at 09:32


            How to to display images according to id (Filters)
            Asked 2020-Feb-19 at 15:16

            I want to display images in a div according to select option (onclick = "DispImg()) I get 2 problem's

            I store the images in array and I display all of theme and when you select an option it will automatically display the images that have the correct id .

            and this is my script : I want to add to every image an id but the (setAttribute) method dosn't work and when you chose what id the script will display only the images that have the same id .



            Answered 2020-Feb-19 at 14:45

            Instead of setAttribute you can replace with just .id but both should work fine


            Community Discussions, Code Snippets contain sources that include Stack Exchange Network


            No vulnerabilities reported

            Install detr

            You can install using 'pip install detr' or download it from GitHub, PyPI.
            You can use detr like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.


            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
          • HTTPS


          • CLI

            gh repo clone facebookresearch/detr

          • sshUrl


          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link