detectron2 | object detection , segmentation | Computer Vision library

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

kandi X-RAY | detectron2 Summary

kandi X-RAY | detectron2 Summary

detectron2 is a Python library typically used in Artificial Intelligence, Computer Vision, Deep Learning, Pytorch applications. detectron2 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 detectron2' or download it from GitHub, PyPI.

Detectron2 is Facebook AI Research's next generation library that provides state-of-the-art detection and segmentation algorithms. It is the successor of Detectron and maskrcnn-benchmark. It supports a number of computer vision research projects and production applications in Facebook.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              detectron2 has a medium active ecosystem.
              It has 25211 star(s) with 6804 fork(s). There are 368 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 312 open issues and 2999 have been closed. On average issues are closed in 9 days. There are 70 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of detectron2 is v0.6

            kandi-Quality Quality

              detectron2 has 0 bugs and 0 code smells.

            kandi-Security Security

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

            kandi-License License

              detectron2 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

              detectron2 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, examples and code snippets are available.
              detectron2 saves you 15932 person hours of effort in developing the same functionality from scratch.
              It has 40741 lines of code, 2528 functions and 426 files.
              It has medium code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed detectron2 and discovered the below as its top functions. This is intended to give you an instant insight into detectron2 implemented functionality, and help decide if they suit your requirements.
            • Generate instance class .
            • Convert files to a dictionary .
            • Collect environment information .
            • Evaluate an image
            • Overlay instances .
            • Rename the Caffe2 weights .
            • Convert datasets to COCO format .
            • Aligns two state dictionaries .
            • r Evaluate the vocab .
            • Finds the top - N proposals for the given proposals .
            Get all kandi verified functions for this library.

            detectron2 Key Features

            No Key Features are available at this moment for detectron2.

            detectron2 Examples and Code Snippets

            Epic Kitchens Object Detector with Detectron2,Getting Started,Prerequisites
            Pythondot img1Lines of Code : 27dot img1License : Permissive (MIT)
            copy iconCopy
            |---
            |   |---annotations
            |   |   |---EPIC_test_s1_object_video_list.csv
            |   |   |---EPIC_test_s2_object_video_list.csv
            |   |   |---EPIC_train_object_labels.csv
            |   |   |---.
            |   |   |---.
            |   |---EPIC_KITCHENS_2018
            |   |   |---object_detection_images  
            End to End Object Detection on AWS SageMaker with Detectron2,Contents
            Jupyter Notebookdot img2Lines of Code : 22dot img2License : Non-SPDX (NOASSERTION)
            copy iconCopy
            ./d2_on_sagemaker/
            ├── README.md
            ├── requirements.txt
            ├── d2_eval.ipynb
            ├── d2_inference.ipynb
            ├── d2_local.ipynb
            ├── d2_train.ipynb
            ├── dataprep
            │   ├── SMGT_to_COCO.py
            │   ├── dataprep.ipynb
            │   └── go_smgt.ipynb
            ├── s  
            NICR Scene Analysis Datasets,Detectron2 usage (experimental support)
            Pythondot img3Lines of Code : 14dot img3License : Permissive (Apache-2.0)
            copy iconCopy
            # the import automatically registers all datasets to d2
            from nicr_scene_analysis_datasets import d2 as nicr_d2
            
            # set the path for the dataset, so that d2 can use it
            # note, dataset_path must point to the actual dataset (e.g. ../datasets/hypersim)
            #   
            detectron2 - demo
            Pythondot img4Lines of Code : 162dot img4License : Non-SPDX (Apache License 2.0)
            copy iconCopy
            # Copyright (c) Facebook, Inc. and its affiliates.
            import argparse
            import glob
            import multiprocessing as mp
            import numpy as np
            import os
            import tempfile
            import time
            import warnings
            import cv2
            import tqdm
            
            from detectron2.config import get_cfg
            from de  
            detectron2 - predictor
            Pythondot img5Lines of Code : 149dot img5License : Non-SPDX (Apache License 2.0)
            copy iconCopy
            # Copyright (c) Facebook, Inc. and its affiliates.
            import atexit
            import bisect
            import multiprocessing as mp
            from collections import deque
            import cv2
            import torch
            
            from detectron2.data import MetadataCatalog
            from detectron2.engine.defaults import Defa  

            Community Discussions

            QUESTION

            How to make inference on multiple images, with detectron2 and DefaultPredictor
            Asked 2022-Apr-09 at 09:45

            I have trained the model, now i would like to use it to detect objects in many images. I saw that the defaultpredictor allows you to detect only on an image, what can I do?

            I am really new to this world. The approach I tried was to use a for loop but it doesn't work. Are there any other methods?

            ...

            ANSWER

            Answered 2022-Apr-09 at 09:45

            Ok, i solved in this way:

            Source https://stackoverflow.com/questions/71802972

            QUESTION

            Error Training Custom COCO Dataset with Detectron2
            Asked 2022-Mar-29 at 11:17

            I'm trying to train a custom COCO-format dataset with Detectron2 on PyTorch. My datasets are json files with the aforementioned COCO-format, with each item in the "annotations" section looking like this:

            The code for setting up Detectron2 and registering the training & validation datasets are as follows:

            ...

            ANSWER

            Answered 2022-Mar-29 at 11:17

            It's difficult to give a concrete answer without looking at the full annotation file, but a KeyError exception is raised when trying to access a key that is not in a dictionary. From the error message you've posted, this key seems to be 'segmentation'.

            This is not in your code snippet, but before even getting into network training, have you done any exploration/inspections using the registered datasets? Doing some basic exploration or inspections would expose any problems with your dataset so you can fix them early in your development process (as opposed to letting the trainer catch them, in which case the error messages could get long and confounding).

            In any case, for your specific issue, you can take the registered training dataset and check if all annotations have the 'segmentation' field. A simple code snippet to do this below.

            Source https://stackoverflow.com/questions/71601691

            QUESTION

            Build confusion matrix for instance segmantation (mask r-cnn from detectron2)
            Asked 2022-Mar-18 at 16:54

            I've trained a mask r-cnn on corn images (I cannot show examples because they are confidential), but they are basically pictures of corn kernels scattered over a flat surface.

            There are different kinds of corn kernels I want to be able to segment and classify. I understand the AP metrics are the best way of measuring the performance of an instance segmentation algorithm and I know a confusion matrix for this kind of algorithm doesn't usually make sense.

            But for his specific case, where I have 4 classes of very similar objects, I would like to be able to set a fixed AP value, like AP50/AP75 and build a confusion matrix for that.

            Would it be possible? How would I do it?

            I used detectron2 library to train and get predictions. Here is the code I use to load my trained model from disk, generate predictions in the validation set, and visualize the results:

            ...

            ANSWER

            Answered 2022-Mar-18 at 16:54

            I was able to do it, I built the confusion matrix function from scratch:

            Source https://stackoverflow.com/questions/71475164

            QUESTION

            Detectron2 prediction problem on my local machine with custom model
            Asked 2022-Mar-04 at 16:25

            I trained a custom model with detectron2 on google colab, and ok, it's working correctly. The model was trained, the predictions were ok, this on google colab. But when I made predictions on my local machine did'nt work. Here a similar example on google colab: https://colab.research.google.com/drive/1bSlH5Am_zFEWbJ9zTRu2wFEDKDvn0LUv?usp=sharing

            I exported de final model and ran with this code:

            ...

            ANSWER

            Answered 2022-Mar-04 at 16:25

            I saved the configs with this comand and then I downloaded.

            Source https://stackoverflow.com/questions/71352708

            QUESTION

            Inference on image dataset without annotations in detectron2
            Asked 2022-Mar-01 at 03:12
            Motivation
            • I have a detectron2 Mask R-CNN baseline model that is good enough to predict some object boundaries accurately.
            • I'd like to convert these predicted boundaries to COCO polygons to annotate the next dataset (supervised labeling).
            • To do this, I need to run inference on an image dataset that does not have annotations.
            • The detectron2 methods register_coco_instances and load_coco_json require images with annotations to properly label the predicted objects.
            Questions
            • Can I register the test dataset without an annotations file?
            • If not, what's the easiest way to generate COCO or Labelme JSON files with basic image info without annotations?
            Code ...

            ANSWER

            Answered 2021-Dec-02 at 14:39

            Here's a method to generate the image details from a directory of images and write it to an existing COCO JSON file:

            Source https://stackoverflow.com/questions/70186513

            QUESTION

            Using detectron2 how do I change how many classes my dataset has
            Asked 2022-Feb-15 at 10:42

            Despite changing the classes line to

            ...

            ANSWER

            Answered 2022-Feb-15 at 10:42

            I figured it out and it was me being dumb

            So let my dumbness provide an answer for anyone else stuck up this particular creek.

            So in addition to adding

            Source https://stackoverflow.com/questions/71108095

            QUESTION

            Detectron2 models not generating any results
            Asked 2022-Feb-03 at 18:03

            I am just trying out detectron2 with some basic code as follows

            ...

            ANSWER

            Answered 2022-Feb-03 at 18:03

            I had the same issue, for me I had two issues to fix. The first was resizing shortest edge. I used the Detectron2 built function from detectron2.data.transforms and imported ResizeShortestEdge. The model values can be found with cfg.INPUT, which will list max/min sizes for test and train. The other issue was matching the color channels with cfg.

            Source https://stackoverflow.com/questions/70722262

            QUESTION

            can't resume training with detectron2
            Asked 2021-Dec-06 at 16:19

            I am training a model on Faster R CNN architecture. For the first session I used the below config:

            ...

            ANSWER

            Answered 2021-Dec-06 at 16:19

            There is no error actually.

            The problem is that your config specifies the maximum iteration as 16000.

            Source https://stackoverflow.com/questions/70244703

            QUESTION

            a['regions'] KeyError in balloon.py
            Asked 2021-Dec-06 at 15:27

            In the balloon.py file in Detectron2 samples, I get a KeyError of 'regions' whenever I run the balloon.py on my custom dataset. I figured something was wrong with the json file in the train folder, so I first used the latest VIA 3 and then VIA 2.0.0. Both jsons create the same KeyError.

            I compared the balloon's training VIA json to my training VIA json, and they have the same structure now, so I'm thinking it isn't a json issue anymore. Why would Python not be able to read a string as a key?

            Here's balloon.py: https://github.com/matterport/Mask_RCNN/blob/master/samples/balloon/balloon.py

            ...

            ANSWER

            Answered 2021-Dec-05 at 21:27

            You haven’t given us your JSON so it’s impossible to tell really, but scanning over the file in the link I don’t think this is you fault, line 117 of balloons.py is

            Source https://stackoverflow.com/questions/70238415

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

            Vulnerabilities

            No vulnerabilities reported

            Install detectron2

            See Getting Started with Detectron2, and the Colab Notebook to learn about basic usage. Learn more at our documentation. And see projects/ for some projects that are built on top of detectron2.

            Support

            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
            CLONE
          • HTTPS

            https://github.com/facebookresearch/detectron2.git

          • CLI

            gh repo clone facebookresearch/detectron2

          • sshUrl

            git@github.com:facebookresearch/detectron2.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link