Giter VIP home page Giter VIP logo

laclouis5 / globox Goto Github PK

View Code? Open in Web Editor NEW
166.0 5.0 20.0 17.42 MB

A package to read and convert object detection datasets (COCO, YOLO, PascalVOC, LabelMe, CVAT, OpenImage, ...) and evaluate them with COCO and PascalVOC metrics.

License: MIT License

Python 100.00%
object-detection metrics coco-api mean-average-precision bounding-boxes annotation average-precision pascal-voc cvat labelme

globox's Introduction

Globox — Object Detection Toolbox

This framework can:

  • parse all kinds of object detection datasets (ImageNet, COCO, YOLO, PascalVOC, OpenImage, CVAT, LabelMe, etc.) and show statistics,
  • convert them to other formats (ImageNet, COCO, YOLO, PascalVOC, OpenImage, CVAT, LabelMe, etc.),
  • and evaluate predictions using standard object detection metrics such as $AP_{[.5:.05:.95]}$, $AP_{50}$, $mAP$, $AR_{1}$, $AR_{10}$, $AR_{100}$.

This framework can be used both as a library in your own code and as a command line tool. This tool is designed to be simple to use, fast and correct.

Install

You can install the package using pip:

pip install globox

Use as a Library

Parse Annotations

The library has three main components:

  • BoundingBox: represents a bounding box with a label and an optional confidence score
  • Annotation: represent the bounding boxes annotations for one image
  • AnnotationSet: represents annotations for a set of images (a database)

The AnnotationSet class contains static methods to read different dataset formats:

# COCO
coco = AnnotationSet.from_coco(file_path="path/to/file.json")

# YOLOv5
yolo = AnnotationSet.from_yolo_v5(
    folder="path/to/files/",
    image_folder="path/to/images/"
)

# Pascal VOC
pascal = AnnotationSet.from_pascal_voc(folder="path/to/files/")

Annotation offers file-level granularity for compatible datasets:

annotation = Annotation.from_labelme(file_path="path/to/file.xml")

For more specific implementations the BoundingBox class contains lots of utilities to parse bounding boxes in different formats, like the create() method.

AnnotationsSets are set-like objects. They can be combined and annotations can be added:

gts = coco | yolo
gts.add(annotation)

Inspect Datasets

Iterators and efficient lookup by image_id's are easy to use:

if annotation in gts:
    print("This annotation is present.")

if "image_123.jpg" in gts.image_ids:
    print("Annotation of image 'image_123.jpg' is present.")

for box in gts.all_boxes:
    print(box.label, box.area, box.is_ground_truth)

for annotation in gts:
    nb_boxes = len(annotation.boxes)
    print(f"{annotation.image_id}: {nb_boxes} boxes")

Datasets stats can printed to the console:

coco_gts.show_stats()
         Database Stats         
┏━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┓
┃ Label       ┃ Images ┃ Boxes ┃
┡━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━┩
│ aeroplane   │     10 │    15 │
│ bicycle     │      7 │    14 │
│ bird        │      4 │     6 │
│ boat        │      7 │    11 │
│ bottle      │      9 │    13 │
│ bus         │      5 │     6 │
│ car         │      6 │    14 │
│ cat         │      4 │     5 │
│ chair       │      9 │    15 │
│ cow         │      6 │    14 │
│ diningtable │      7 │     7 │
│ dog         │      6 │     8 │
│ horse       │      7 │     7 │
│ motorbike   │      3 │     5 │
│ person      │     41 │    91 │
│ pottedplant │      6 │     7 │
│ sheep       │      4 │    10 │
│ sofa        │     10 │    10 │
│ train       │      5 │     6 │
│ tvmonitor   │      8 │     9 │
├─────────────┼────────┼───────┤
│ Total       │    100 │   273 │
└─────────────┴────────┴───────┘

Convert and Save to Many Formats

Datasets can be converted to and saved in other formats:

# ImageNet
gts.save_imagenet(save_dir="pascalVOC_db/")

# YOLO Darknet
gts.save_yolo_darknet(
    save_dir="yolo_train/", 
    label_to_id={"cat": 0, "dog": 1, "racoon": 2}
)

# YOLOv5
gts.save_yolo_v5(
    save_dir="yolo_train/", 
    label_to_id={"cat": 0, "dog": 1, "racoon": 2},
)

# CVAT
gts.save_cvat(path="train.xml")

COCO Evaluation

COCO Evaluation is also supported:

evaluator = COCOEvaluator(
    ground_truths=gts, 
    predictions=dets
)

ap = evaluator.ap()
ar_100 = evaluator.ar_100()
ap_75 = evaluator.ap_75()
ap_small = evaluator.ap_small()
...

All COCO standard metrics can be displayed in a pretty printed table with:

evaluator.show_summary()

which outputs:

                              COCO Evaluation
┏━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━┳...┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┓
┃ Label     ┃ AP 50:95 ┃  AP 50 ┃   ┃   AR S ┃   AR M ┃   AR L ┃
┡━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━╇...╇━━━━━━━━╇━━━━━━━━╇━━━━━━━━┩
│ airplane  │    22.7% │  25.2% │   │   nan% │  90.0% │   0.0% │
│ apple     │    46.4% │  57.4% │   │  48.5% │   nan% │   nan% │
│ backpack  │    54.8% │  85.1% │   │ 100.0% │  72.0% │   0.0% │
│ banana    │    73.6% │  96.4% │   │   nan% │ 100.0% │  70.0% │
.           .          .        .   .        .        .        .
.           .          .        .   .        .        .        .
.           .          .        .   .        .        .        .
├───────────┼──────────┼────────┼...┼────────┼────────┼────────┤
│ Total     │    50.3% │  69.7% │   │  65.4% │  60.3% │  55.3% │
└───────────┴──────────┴────────┴...┴────────┴────────┴────────┘

The array of results can be saved in CSV format:

evaluator.save_csv("where/to/save/results.csv")

Custom evaluations can be achieved with:

evaluation = evaluator.evaluate(
    iou_threshold=0.33,
    max_detections=1_000,
    size_range=(0.0, 10_000)
)

ap = evaluation.ap()
cat_ar = evaluation["cat"].ar

Evaluations are cached by (iou_threshold, max_detections, size_range) keys. This means that repetead queries to the evaluator are fast!

Use in Command Line

If you only need to use Globox from the command line like an application, you can install the package through pipx:

pipx install globox

Globox will then be in your shell path and usable from anywhere.

Usage

Get a summary of annotations for one dataset:

globox summary /yolo/folder/ --format yolo

Convert annotations from one format to another one:

globox convert input/yolo/folder/ output_coco_file_path.json --format yolo --save_fmt coco

Evaluate a set of detections with COCO metrics, display them and save them in a CSV file:

globox evaluate groundtruths/ predictions.json --format yolo --format_dets coco -s results.csv

Show the help message for an exhaustive list of options:

globox summary -h
globox convert -h
globox evaluate -h

Run Tests

Clone the repo with its test data:

git clone https://github.com/laclouis5/globox --recurse-submodules=tests/globox_test_data
cd globox

Install with Poetry:

poetry install

Run the tests:

poetry run pytest

Speed Banchmarks

Speed benchmark can be executed with:

python tests/benchmark.py -n 5

The following speed test is performed using Python 3.11 and timeit with 5 iterations on a 2021 MacBook Pro 14" (M1 Pro 8 Cores and 16 GB of RAM). The dataset is COCO 2017 Validation which comprises 5k images and 36 781 bounding boxes.

Task COCO CVAT OpenImage LabelMe PascalVOC YOLO TXT
Parsing 0.22s 0.12s 0.44s 0.60s 0.97s 1.45s 1.12s
Saving 0.32s 0.17s 0.14s 1.06s 1.08s 0.91s 0.85s
  • AnnotationSet.show_stats(): 0.02 s
  • Evalaution: 0.30 s

Todo

  • Basic data structures and utilities
  • Parsers (ImageNet, COCO, YOLO, Pascal, OpenImage, CVAT, LabelMe)
  • Parser tests
  • Database summary and stats
  • Database converters
  • Visualization options
  • COCO Evaluation
  • Tests with a huge load (5k images)
  • CLI interface
  • Make image_size optional and raise err when required (bbox conversion)
  • Make file saving atomic with a temporary to avoid file corruption
  • Pip package!
  • PascalVOC Evaluation
  • Parsers for TFRecord and TensorFlow
  • UI interface?

Acknowledgement

This repo is based on the work of Rafael Padilla.

Contribution

Feel free to contribute, any help you can offer with this project is most welcome.

globox's People

Contributors

christophbrosch avatar dsgibbons avatar eladmeir avatar fabito avatar laclouis5 avatar louislac-neovision avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

globox's Issues

NameError: name 'AnnotationSet' is not defined

So i did a pip install globox

then in my python...

"
import globox

yolo_preds = AnnotationSet.from_yolo(
folder="D:\AI\mydata\labels",
image_folder="D:\AI\mydata\images")
"

following the demo code...
I then get
Exception has occurred: NameError
name 'AnnotationSet' is not defined

what have i missed?

An error occurred while converting from Yolo format to coco format.

#yolotococo format

from globox import AnnotationSet

yolo = AnnotationSet.from_yolo_darknet(
folder= r'C:\Users\Desktop\nem-process\label' ,
image_folder= r'C:\Users\Desktop\nem-process\images'
)

yolo.show_stats()
cocodata=yolo.save_coco(r'C:\Users\Downloads\globox-main\globox-main')

The output of show_stats() is
Database Stats
┏━━━━━━━┳━━━━━━━━┳━━━━━━━┓
┃ Label ┃ Images ┃ Boxes ┃
┡━━━━━━━╇━━━━━━━━╇━━━━━━━┩
│ 0 │ 41 │ 269 │
│ 1 │ 6 │ 8 │
├───────┼────────┼───────┤
│ Total │ 46 │ 277 │
└───────┴────────┴───────┘

Error displayed as:

File "C:\Users\anaconda3\envs\tf\lib\site-packages\globox\annotationset.py", line 602, in to_coco
raise ValueError("For COCO, mappings from labels and image ids to integer ids are required. They can be provided either by argument or automatically by the AnnotationSet instance if it was created with AnnotationSet.from_coco() or AnnotationSet.from_coco_results(). You can also set auto_ids to True to automatically create image and label ids (warning: this could cause unexpected compatibility issues with other COCO datasets).")

AttributeError: 'Namespace' object has no attribute 'norm_dets'. When using `format_dets` with value `txt`.

Describe the bug
Thank you for this awesome tool. There seems to be a bug in cli when specifying --format_dets txt. A simple fix may be renaming norm_in_dets found here to norm_dets (or vise versa) if I understood the code correctly.

To Reproduce
Steps to reproduce the behavior:

  1. Specify --format_dets txt --norm_dets rel detection options when using globox cli tool.

Expected behavior
No error happens and I can use both --format_dets txt and --norm_dets rel.

Environment (please complete the following information):

  • Ubuntu 22.04 (WSL).
  • Globox version 2.4.3.
  • Python 3.10.12.

Additional context
Error traceback:

Traceback (most recent call last):
  File "/home/user/.local/bin/globox", line 8, in <module>
    sys.exit(main())
  File "/home/user/.local/lib/python3.10/site-packages/globox/cli.py", line 384, in main
    predictions = parse_dets_annotations(args, coco_gts=coco_gts)
  File "/home/user/.local/lib/python3.10/site-packages/globox/cli.py", line 268, in parse_dets_annotations
    relative: bool = args.norm_dets == "rel"
AttributeError: 'Namespace' object has no attribute 'norm_dets'. Did you mean: 'format_dets'?

YoloV5 label file parsing bug

Describe the bug
YoloV5 label txt files do not always use a single space as a delimiter. Some tools generate yolo-compatible labels with tab as a delimiter. However, parsing these labels in globox leads to an error since the default separator must be a single space character. Globox would be more robust if it allowed any whitespace character as delimiters for yolo label files.

To Reproduce
Change any yolo label file so that it has one non-space delimiter such as tab and try to parse in the label files with AnnotationSet.from_yolo_v5

Expected behavior
File parsing error occurs, e.g.

File "/home/lonrix/miniconda3/envs/training_data_processing/lib/python3.11/site-packages/globox/annotation.py", line 136, in from_txt
    raise FileParsingError(path, e.reason)
globox.errors.FileParsingError: Error while reading file '/home/lonrix/train/faults_v4_taurangacc_2023/val/labels/1187B1R1-ROW-00159.txt': Syntax error in txt annotation file.

Environment (please complete the following information):

  • Python 3.11, latest version of globox.

TypeError: unsupported operand type(s) for +: 'AnnotationSet' and 'AnnotationSet'

Describe the bug
When trying to combine multiple AnnotationSet objects, get unsupported operand type '+'.

To Reproduce
Steps to reproduce the behavior:

coco1 = AnnotationSet.from_coco("coco-1/annotations/instances_default.json")
coco2 = AnnotationSet.from_coco("coco-2/annotations/instances_default.json")
coco = coco1+coco2

Expected behavior
Per the documentation, I expected the ability of combining AnnotationSet objects.

Environment (please complete the following information):

  • Ubuntu 22.04
  • Python 3.10.6
  • Globox 2.1.0

Additional context
I believe we need to add an __add__ method to support AnnotationSet concatenation.

globox summary: error: the following arguments are required: input

I'm want to use globox as a command-line tool on a Windows 10 system within Anaconda. The repo installed fine, but I cannot access a Yolo dataset. I have attempted to use both Windows and Unix file path styles.

Below is an image of the error.

All the images and .txt files are in the LACEx folder. Any help is greatly appreciated.

Thanks,

image

Unable to solve the missed image problem

I use coco128 as an example, and coco128 has some labels that did not match to any images, and which will raise the bug:

from globox import AnnotationSet

yolo = AnnotationSet.from_yolo(
    folder="./coco128/coco128/labels/train2017",
    image_folder="./coco128/coco128/images/train2017"
)


>>>
AssertionError: File ./coco128/coco128/images/train2017/000000000659.jpg does not exists, unable to read the image size.

Do you have any idea to solve it ? I'm not sure if it's a bug or we need to add some new features for this situation

repo download takes a long time

  1. The connection to globox_test_data as a submodule forces the user to download an unreasonably large repo.
  2. This brings the size of the git folder to 1.5 GB. Caused by the globox_test_data submodule containing large image files.
  3. Time to download the repo is very long, because globox_test_data takes a long time to download.
  4. Relating to the globox_test_data project - Large image collections shouldn't be saved in git.

Relax globox numpy version requirements so it can coexist with tensorflow

Is your feature request related to a problem? Please describe.
globox numpy version requirements conflicts with latest tensorflow 2.12.0

# tensorflow 
numpy<1.24,>=1.22 (from tensorflow==2.12.0)

# globox 
numpy<2.0.0,>=1.24.3 (from globox==2.1.3)

globox 2.1.3 requires numpy<2.0.0,>=1.24.3, but you have numpy 1.23.1 which is incompatible.

Describe the solution you'd like
Relax numpy version requirements, if possible, so I can add both dependencies to my project.

Single Image score

In my scenario, I need to compute the mAP.5:.95 metric for an individual image output.
I have two files at my disposal, e.g. ground_truth.txt and prediction.txt. I am seeking guidance on how to utilize the globox library to calculate the scores for a single file.

Yolo txt To coco json Conversion

Hello Louis.

I am trying to convert segmentation annotations from yolov8 txt format into coco json format so as to be able to use with Labelme tool. I tried to use the following code:

from globox import AnnotationSet

predictions = AnnotationSet.from_yolo_v5("/Block/labels", image_folder="/Block/images")

predictions.save_coco("coco_preds.json", label_to_id={"person": 0, "bicycle": 1, "car": 2, "motorcycle": 3, "airplane": 4}, imageid_to_id={im: i for i, im in enumerate(sorted(predictions.image_ids))})

I get the following error:

AssertionError: File /Block/images/Block_338.jpg does not exists, unable to read the image size.

All my images are in PNG format, is that the source of the error, or am I doing something wrong?

Environment:

  • Ubuntu 20.04
  • Globox version 2.2.0

Looking forward to your reply.

Thanks in advance,
Adhok

Convert yolov5 dataset labels into COCO labels

Hi. I want to compare the performance between yolov5 and DETR (from Hugging Face). The custom dataset I have has already txt lables in YOLO format. However, DETR expects labels to be in COCO format.
Can anybody help me how to use this tool?

dataset.yaml

# Paths
train: ~/Dataset/train/images
val: ~/Dataset/val/images
test: ~/Dataset/test/images

# Classes
names: 
    0: person

COCO BBOX IDs

Brooo, your COCO label bbox id generation is not right. They're supposed to be unique numbers for each bbox.

Import error

Python 3.8.12

Hi @laclouis5, the library looks nice, but when I'm trying to use it have an error.

>>> import globox
 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/conda/lib/python3.8/site-packages/globox/__init__.py", line 2, in <module>
    from .annotation import Annotation
  File "/opt/conda/lib/python3.8/site-packages/globox/annotation.py", line 11, in <module>
    class Annotation: 
  File "/opt/conda/lib/python3.8/site-packages/globox/annotation.py", line 19, in Annotation
    image_size: Optional[tuple[int, int]] = None, 
TypeError: 'type' object is not subscriptable```

Import

Hi I'm trying to use your tool but something is getting in the way with imports.

here's the python code:

from ObjectDetectionEval import *
from pathlib import Path

def main() -> None:
    path = Path('D:/tesi/dataset/detr_imbalanced')  
    names_file = Path('D:/tesi/classi.txt')
    save_file = Path('yoloToCoco.json')

    annotations = AnnotationSet.from_yolo(path).map_labels(names_file)


    annotations.save_coco(save_file)


if __name__ == '__main__':
    main()

this is the error:
Traceback (most recent call last):
File "D:\tesi\dataset\script\yoloToCoco.py", line 20, in
main()
File "D:\tesi\dataset\script\yoloToCoco.py", line 10, in main
annotations = AnnotationSet.from_yolo(path).map_labels(names_file)
NameError: name 'AnnotationSet' is not defined. Did you mean: 'annotations'?

Process finished with exit code 1

Any ideas? Thanks a lot

Changing aperio xml format annotation to json annotation

Dear author,
Can you explain how to use your code for converting Aperio Imagescope annotation to Coco .json annotation?
I have an annotation file in this format:

Annotations MicronsPerPixel="0.500000">
	<Annotation Id="1" Name="" ReadOnly="0" NameReadOnly="0" LineColorReadOnly="0" Incremental="0" Type="4" LineColor="65280" Visible="1" Selected="1" MarkupImagePath="" MacroName="">
		<Attributes>
			<Attribute Name="Description" Id="0" Value=""/>
		</Attributes>
		<Regions>
			<RegionAttributeHeaders>
				<AttributeHeader Id="9999" Name="Region" ColumnWidth="-1"/>
				<AttributeHeader Id="9997" Name="Length" ColumnWidth="-1"/>
				<AttributeHeader Id="9996" Name="Area" ColumnWidth="-1"/>
				<AttributeHeader Id="9998" Name="Text" ColumnWidth="-1"/>
				<AttributeHeader Id="1" Name="Description" ColumnWidth="-1"/>
			</RegionAttributeHeaders>
			<Region Id="1" Type="2" Zoom="1" Selected="0" ImageLocation="" ImageFocus="0" Length="138.3" Area="1517.4" LengthMicrons="69.2" AreaMicrons="379.3" Text="Mitosis" NegativeROA="0" InputRegionId="0" Analyze="0" DisplayId="1">
				<Attributes/>
				<Vertices>
					<Vertex X="6595" Y="24009"/>
					<Vertex X="6642" Y="24051"/>
				</Vertices>
.
.
.
.
.
				</Vertices>
			</Region>
		</Regions>
		<Plots/>
	</Annotation>
</Annotations>

And I want to convert this annotation .XML file into Coco.json format :

{"info": {"description": "MItosis Domain Generalization Challenge (MIDOG) 2021 - Training set", "version": "1.0", "year": 2020, "contributor": "Marc Aubreville, Christof Bertram, Mitko Veta, Robert Klopfleisch, Nikolas Stathonikos, Natalie ter Hoeve, Taryn Donovan, Katharina Breininger, Andreas Maier", "date_created": "2021/04/01"}, "licenses": [{"url": "http://creativecommons.org/licenses/by-nc-nd/2.0/", "id": 1, "name": "Attribution-NonCommercial-NoDerivs License"}], "images": [{"license": 1, "file_name": "001.tiff", "id": 1, "width": 7215, "height": 5412}, {"license": 1, "file_name": "002.tiff", "id": 2, "width": 7215, "height": 5412}, {"license": 1, "file_name": "003.tiff", "id": 3, "width": 7215, "height": 5412},......
 "categories": [{"id": 1, "name": "mitotic figure"}, {"id": 2, "name": "not mitotic figure"}], "annotations": [{"bbox": [4336, 346, 4386, 396], "category_id": 2, "image_id": 1, "id": 1}, {"bbox": [756, 872, 806, 922], "category_id": 2, "image_id": 1, "id": 2}, {"bbox": [270, 4044, 320, 4094], "category_id": 2, "image_id": 1, "id": 3}, {"bbox": [6672.5, 706.5, 6722.5, 756.5], "category_id": 2, "image_id": 1, "id": 4}, {"bbox": [1872, 319, 1922, 369], "category_id": 2, "image_id": 2, "id": 5}, {"bbox": [4397, 191, 4447, 241], "category_id": 1, "image_id": 2, "id": 6}, 
...........
"category_id": 2, "image_id": 150, "id": 4434}, {"bbox": [2681.5, 2846, 2731.5, 2896], "category_id": 2, "image_id": 150, "id": 4435}]}

Can you please help me with how to perform the following conversion?
Thanking you in advance,
Warm regards,
Harshit

Converting from YOLO annotation files to a format readable by the VGG Image Annotator (VIA)

I have YOLOv7 predictions like this:

path/to/test/
 |-img     # the images
 \-labels # txt YOLO files (predictions for each image)

I want to read the YOLO txt files and the image width & height and convert that info to a format readable by the VGG Image Annotator (VIA).

There are 2 options: CSV or JSON file formats.

Here are two files as examples:
via_project_4Nov2022_11h34m_csv.csv
via_project_4Nov2022_11h43m.json

Would it be possible to make use of the functionality of your package to easily convert from YOLo txt annotation files to something that i can easily import in the VGG Image Annotator (VIA)?

Meanwhile, I went ahead to try out globox.AnnotationSet.from_yolo and got this error message AttributeError: 'str' object has no attribute 'is_dir':

import globox
import os

# Get current directory based on where this script file is located
local_dir = os.path.dirname(os.path.abspath(__name__))

yolo_preds = globox.AnnotationSet.from_yolo(
    folder = os.path.join(local_dir, 'test', 'labels'), # path to yolo prediction txt files
    image_folder = os.path.join(local_dir, 'test', 'img')) # path to images
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
~/.../yolo_to_json.py in <module>
      6 local_dir = os.path.dirname(os.path.abspath(__name__))
      7 
----> 8 yolo_preds = globox.AnnotationSet.from_yolo(
      9     folder = os.path.join(local_dir, 'test', 'labels'), # path to yolo prediction txt files
     10     image_folder = os.path.join(local_dir, 'test', 'img')) # path to images

~/.local/lib/python3.10/site-packages/globox/annotationset.py in from_yolo(folder, image_folder, image_extension, verbose)
    188         verbose: bool = False
    189     ) -> "AnnotationSet":
--> 190         return AnnotationSet.from_txt(folder, 
    191             image_folder=image_folder,
    192             box_format=BoxFormat.XYWH,

~/.local/lib/python3.10/site-packages/globox/annotationset.py in from_txt(folder, image_folder, box_format, relative, file_extension, image_extension, separator, verbose)
    150         """This method won't try to retreive the image sizes by default. Specify `image_folder` if you need them. `image_folder` is required when `relative` is True."""
    151         # TODO: Add error handling
--> 152         assert folder.is_dir()
    153         assert image_extension.startswith(".")
    154 

AttributeError: 'str' object has no attribute 'is_dir'

Assertion Error

Hi,

I am working with yolov5 and my goal is to obtain AP Across Scales metrics of my predictions.

I got AssertionError while using your package and I have no idea how to solve. Or maybe I am doing a mistake.

Here is the codes I used and explanations.

yolo_ground_truth = AnnotationSet.from_yolo_v5( folder="I am giving label's path", # txt file for each image, yolo format image_folder="I am giving image's path")

yolo_predictions = AnnotationSet.from_yolo_v5( folder="I am giving predicted label's path", # txt file for each image, yolov5's output image_folder="I am giving image's path")

evaluator = COCOEvaluator( ground_truths= yolo_ground_truth, predictions= yolo_predictions)

And I got the error below

    442 @classmethod
    443 def evaluate_boxes(
    444     cls
   (...)
    449     size_range: "tuple[float, float]",
    450 ) -> PartialEvaluationItem:


--> 451     assert all(p.is_detection for p in predictions)
    452     assert all(g.is_ground_truth for g in ground_truths)
    453     assert all_equal(p.label for p in predictions)

AssertionError:** 

Can you please help me ?

repo download takes a long time

  1. The connection to globox_test_data as a submodule forces the user to download an unreasonably large repo.
  2. This brings the size of the git folder to 1.5 GB. Caused by the globox_test_data submodule containing large image files.
  3. Time to download the repo is very long, because globox_test_data takes a long time to download.
  4. Relating to the globox_test_data project - Large image collections shouldn't be saved in git.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.