Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature request] Add YOLO annotation format #66

Closed
leo-smi opened this issue Jun 20, 2024 · 25 comments · Fixed by #68
Closed

[feature request] Add YOLO annotation format #66

leo-smi opened this issue Jun 20, 2024 · 25 comments · Fixed by #68
Assignees

Comments

@leo-smi
Copy link

leo-smi commented Jun 20, 2024

Add YOLO annotation format: https://docs.ultralytics.com/datasets/detect/#ultralytics-yolo-format

Thank you!

@sumn2u sumn2u self-assigned this Jun 20, 2024
@sumn2u
Copy link
Owner

sumn2u commented Jun 20, 2024

Hi @leo-smi. Thanks for providing the format. I made a draft PR #68 that supports the YOLO format. It would be great if you could take a look and confirm if it's what you want.

@leo-smi
Copy link
Author

leo-smi commented Jun 20, 2024

I'm getting server error when i try to import the images
image

I'll try to update NPM dependencies

@leo-smi
Copy link
Author

leo-smi commented Jun 20, 2024

Updated and still not working :/

@leo-smi
Copy link
Author

leo-smi commented Jun 20, 2024

image

@sumn2u
Copy link
Owner

sumn2u commented Jun 21, 2024

You also need to run the server application, which is located in the server folder mentioned here.

The PR is updated and contains all the source code to support the YOLO format. A sample format is added here.

yolo_orange.txt

Orange 0.001444986061354755 0.001854118235452624 0.0015610492107706593 0.0026357139206293987

Here, Orange is the class name.

@leo-smi
Copy link
Author

leo-smi commented Jun 21, 2024

almost worked (I ran both servers at same time, python and npm):

image
image
image
image

python error:

(base) PS E:\> cd e:/e_downloads/annotate-lab-issue-66/server
(base) PS E:\e_downloads\annotate-lab-issue-66\server> & E:/Programas/PYTHON/Python3.12.2/python.exe e:/e_downloads/annotate-lab-issue-66/server/app.py
 * Tip: There are .env or .flaskenv files present. Do "pip install python-dotenv" to use them.
 * Serving Flask app 'app'
 * Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on http://127.0.0.1:5000
Press CTRL+C to quit
127.0.0.1 - - [20/Jun/2024 23:40:17] "OPTIONS /upload HTTP/1.1" 200 -
127.0.0.1 - - [20/Jun/2024 23:40:17] "POST /upload HTTP/1.1" 201 -
127.0.0.1 - - [20/Jun/2024 23:40:18] "GET /uploads/IMG_20230819_162654_HDR.jpg HTTP/1.1" 200 -
127.0.0.1 - - [20/Jun/2024 23:40:18] "GET /uploads/IMG_20230819_162635_HDR.jpg HTTP/1.1" 200 -
127.0.0.1 - - [20/Jun/2024 23:40:18] "GET /uploads/IMG_20230819_162644_HDR.jpg HTTP/1.1" 200 -
127.0.0.1 - - [20/Jun/2024 23:40:19] "GET /uploads/IMG_20230819_162635_HDR.jpg HTTP/1.1" 304 -
127.0.0.1 - - [20/Jun/2024 23:40:19] "GET /uploads/IMG_20230819_162654_HDR.jpg HTTP/1.1" 304 -
127.0.0.1 - - [20/Jun/2024 23:40:19] "GET /uploads/IMG_20230819_162644_HDR.jpg HTTP/1.1" 304 -
127.0.0.1 - - [20/Jun/2024 23:40:19] "GET /uploads/IMG_20230819_162654_HDR.jpg HTTP/1.1" 304 -
127.0.0.1 - - [20/Jun/2024 23:40:26] "OPTIONS /activeImage HTTP/1.1" 200 -
Database: Empty DataFrame
Columns: [image-name, selected-classes, comment, image-original-height, image-original-width, image-src, processed]
Index: []
Adding new data to database: {'image-name': ['IMG_20230819_162654_HDR'], 'image-src': ['http://127.0.0.1:5000/uploads/IMG_20230819_162654_HDR.jpg'], 'comment': [''], 'selected-classes': ['cherry'], 'image-original-height': [2400], 'image-original-width': [2400], 'processed': [1]}
selected class: cherry
adding image ('IMG_20230819_162654_HDR', '.jpg') to category cherry with base name IMG_20230819_162654_HDR.jpg
127.0.0.1 - - [20/Jun/2024 23:40:26] "POST /activeImage HTTP/1.1" 200 -
127.0.0.1 - - [20/Jun/2024 23:40:27] "GET /uploads/IMG_20230819_162635_HDR.jpg HTTP/1.1" 304 -
127.0.0.1 - - [20/Jun/2024 23:40:32] "OPTIONS /activeImage HTTP/1.1" 200 -
Database:                   image-name selected-classes comment image-original-height image-original-width                                          image-src processed
0  [IMG_20230819_162654_HDR]         [cherry]      []                [2400]               [2400]  [http://127.0.0.1:5000/uploads/IMG_20230819_16...       [1]
Adding new data to database: {'image-name': ['IMG_20230819_162635_HDR'], 'image-src': ['http://127.0.0.1:5000/uploads/IMG_20230819_162635_HDR.jpg'], 'comment': [''], 'selected-classes': [''], 'image-original-height': [2400], 'image-original-width': [2400], 'processed': [1]}
127.0.0.1 - - [20/Jun/2024 23:40:32] "POST /activeImage HTTP/1.1" 200 -
127.0.0.1 - - [20/Jun/2024 23:40:35] "GET /uploads/IMG_20230819_162644_HDR.jpg HTTP/1.1" 304 -
127.0.0.1 - - [20/Jun/2024 23:40:43] "OPTIONS /activeImage HTTP/1.1" 200 -
Database:                   image-name selected-classes comment image-original-height image-original-width                                          image-src processed
0  [IMG_20230819_162654_HDR]         [cherry]      []                [2400]               [2400]  [http://127.0.0.1:5000/uploads/IMG_20230819_16...       [1]
1  [IMG_20230819_162635_HDR]               []      []                [2400]               [2400]  [http://127.0.0.1:5000/uploads/IMG_20230819_16...       [1]
Adding new data to database: {'image-name': ['IMG_20230819_162644_HDR'], 'image-src': ['http://127.0.0.1:5000/uploads/IMG_20230819_162644_HDR.jpg'], 'comment': [''], 'selected-classes': [''], 'image-original-height': [2400], 'image-original-width': [2400], 'processed': [1]}
127.0.0.1 - - [20/Jun/2024 23:40:43] "POST /activeImage HTTP/1.1" 200 -
127.0.0.1 - - [20/Jun/2024 23:40:44] "OPTIONS /save HTTP/1.1" 200 -
Database:                   image-name selected-classes comment image-original-height image-original-width                                          image-src processed
0  [IMG_20230819_162654_HDR]         [cherry]      []                [2400]               [2400]  [http://127.0.0.1:5000/uploads/IMG_20230819_16...       [1]
1  [IMG_20230819_162635_HDR]               []      []                [2400]               [2400]  [http://127.0.0.1:5000/uploads/IMG_20230819_16...       [1]
2  [IMG_20230819_162644_HDR]               []      []                [2400]               [2400]  [http://127.0.0.1:5000/uploads/IMG_20230819_16...       [1]
Adding new data to database: {'image-name': ['IMG_20230819_162644_HDR'], 'image-src': ['http://127.0.0.1:5000/uploads/IMG_20230819_162644_HDR.jpg'], 'comment': [''], 'selected-classes': [''], 'image-original-height': [2400], 'image-original-width': [2400], 'processed': [1]}
Database: Empty DataFrame
Columns: [region-id, image-src, class, comment, tags, x, y, w, h]
Index: []
Adding new data to database: {'region-id': '29635746783475514', 'image-src': 'http://127.0.0.1:5000/uploads/IMG_20230819_162644_HDR.jpg', 'class': 'cherry', 'comment': '', 'tags': '', 'x': [0.19230769230769232], 'y': [0.2053588801979], 'w': [0.5341880341880343], 'h': [0.5235042735042736]}
127.0.0.1 - - [20/Jun/2024 23:40:44] "POST /save HTTP/1.1" 200 -
127.0.0.1 - - [20/Jun/2024 23:40:54] "OPTIONS /download_yolo_annotations HTTP/1.1" 200 -
Annotations: ['cherry 1102.5641025641025 1121.0664406800884 1282.0512820512822 1256.4102564102568']
Annotations: ['cherry 1102.5641025641025 1121.0664406800884 1282.0512820512822 1256.4102564102568']
Temp file: IMG_20230819_162644_HDR.txt
[2024-06-20 23:40:54,366] ERROR in app: Exception on /download_yolo_annotations [POST]
Traceback (most recent call last):
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 1463, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 872, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask_cors\extension.py", line 178, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
                                                ^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 870, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 855, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask_cors\decorator.py", line 130, in wrapped_function
    resp = make_response(f(*args, **kwargs))
                         ^^^^^^^^^^^^^^^^^^
  File "e:\e_downloads\annotate-lab-issue-66\server\app.py", line 554, in download_yolo_annotations
    os.remove(temp_file)
PermissionError: [WinError 32] O arquivo já está sendo usado por outro processo: 'IMG_20230819_162644_HDR.txt'
127.0.0.1 - - [20/Jun/2024 23:40:54] "POST /download_yolo_annotations HTTP/1.1" 500 -
Annotations: ['cherry 1102.5641025641025 1121.0664406800884 1282.0512820512822 1256.4102564102568']
Annotations: ['cherry 1102.5641025641025 1121.0664406800884 1282.0512820512822 1256.4102564102568']
Temp file: IMG_20230819_162644_HDR.txt
[2024-06-20 23:40:56,924] ERROR in app: Exception on /download_yolo_annotations [POST]
Traceback (most recent call last):
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 1463, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 872, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask_cors\extension.py", line 178, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
                                                ^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 870, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 855, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask_cors\decorator.py", line 130, in wrapped_function
    resp = make_response(f(*args, **kwargs))
                         ^^^^^^^^^^^^^^^^^^
  File "e:\e_downloads\annotate-lab-issue-66\server\app.py", line 554, in download_yolo_annotations
    os.remove(temp_file)
PermissionError: [WinError 32] O arquivo já está sendo usado por outro processo: 'IMG_20230819_162644_HDR.txt'
127.0.0.1 - - [20/Jun/2024 23:40:56] "POST /download_yolo_annotations HTTP/1.1" 500 -
127.0.0.1 - - [20/Jun/2024 23:40:58] "OPTIONS /save HTTP/1.1" 200 -
Database:                   image-name selected-classes comment image-original-height image-original-width                                          image-src processed
0  [IMG_20230819_162654_HDR]         [cherry]      []                [2400]               [2400]  [http://127.0.0.1:5000/uploads/IMG_20230819_16...       [1]
1  [IMG_20230819_162635_HDR]               []      []                [2400]               [2400]  [http://127.0.0.1:5000/uploads/IMG_20230819_16...       [1]
2  [IMG_20230819_162644_HDR]               []      []                [2400]               [2400]  [http://127.0.0.1:5000/uploads/IMG_20230819_16...       [1]
3  [IMG_20230819_162644_HDR]               []      []                [2400]               [2400]  [http://127.0.0.1:5000/uploads/IMG_20230819_16...       [1]
Adding new data to database: {'image-name': ['IMG_20230819_162644_HDR'], 'image-src': ['http://127.0.0.1:5000/uploads/IMG_20230819_162644_HDR.jpg'], 'comment': [''], 'selected-classes': [''], 'image-original-height': [2400], 'image-original-width': [2400], 'processed': [1]}
Database:            region-id                                          image-src   class comment tags                      x                  y                     w                     h
0  29635746783475514  http://127.0.0.1:5000/uploads/IMG_20230819_162...  cherry               [0.19230769230769232]  [0.2053588801979]  [0.5341880341880343]  [0.5235042735042736]
Updating existing data in database: {'region-id': '29635746783475514', 'image-src': 'http://127.0.0.1:5000/uploads/IMG_20230819_162644_HDR.jpg', 'class': 'cherry', 'comment': '', 'tags': '', 'x': [0.19230769230769232], 'y': [0.2053588801979], 'w': [0.5341880341880343], 'h': [0.5235042735042736]}
selected_classes_str: cherry
127.0.0.1 - - [20/Jun/2024 23:40:58] "POST /save HTTP/1.1" 200 -
127.0.0.1 - - [20/Jun/2024 23:41:02] "OPTIONS /download_yolo_annotations HTTP/1.1" 200 -
Annotations: ['cherry 1102.5641025641025 1121.0664406800884 1282.0512820512822 1256.4102564102568']
Annotations: ['cherry 1102.5641025641025 1121.0664406800884 1282.0512820512822 1256.4102564102568']
Temp file: IMG_20230819_162644_HDR.txt
[2024-06-20 23:41:02,511] ERROR in app: Exception on /download_yolo_annotations [POST]
Traceback (most recent call last):
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 1463, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 872, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask_cors\extension.py", line 178, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
                                                ^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 870, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 855, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask_cors\decorator.py", line 130, in wrapped_function
    resp = make_response(f(*args, **kwargs))
                         ^^^^^^^^^^^^^^^^^^
  File "e:\e_downloads\annotate-lab-issue-66\server\app.py", line 554, in download_yolo_annotations
    os.remove(temp_file)
PermissionError: [WinError 32] O arquivo já está sendo usado por outro processo: 'IMG_20230819_162644_HDR.txt'
127.0.0.1 - - [20/Jun/2024 23:41:02] "POST /download_yolo_annotations HTTP/1.1" 500 -
127.0.0.1 - - [20/Jun/2024 23:42:11] "GET /uploads/IMG_20230819_162635_HDR.jpg HTTP/1.1" 304 -
127.0.0.1 - - [20/Jun/2024 23:42:12] "GET /uploads/IMG_20230819_162654_HDR.jpg HTTP/1.1" 304 -
127.0.0.1 - - [20/Jun/2024 23:42:15] "OPTIONS /download_yolo_annotations HTTP/1.1" 200 -
Annotations: []
Annotations: []
Temp file: IMG_20230819_162654_HDR.txt
[2024-06-20 23:42:15,265] ERROR in app: Exception on /download_yolo_annotations [POST]
Traceback (most recent call last):
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 1463, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 872, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask_cors\extension.py", line 178, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
                                                ^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 870, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 855, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask_cors\decorator.py", line 130, in wrapped_function
    resp = make_response(f(*args, **kwargs))
                         ^^^^^^^^^^^^^^^^^^
  File "e:\e_downloads\annotate-lab-issue-66\server\app.py", line 554, in download_yolo_annotations
    os.remove(temp_file)
PermissionError: [WinError 32] O arquivo já está sendo usado por outro processo: 'IMG_20230819_162654_HDR.txt'
127.0.0.1 - - [20/Jun/2024 23:42:15] "POST /download_yolo_annotations HTTP/1.1" 500 -
Annotations: []
Annotations: []
Temp file: IMG_20230819_162654_HDR.txt
[2024-06-20 23:42:17,071] ERROR in app: Exception on /download_yolo_annotations [POST]
Traceback (most recent call last):
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 1463, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 872, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask_cors\extension.py", line 178, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
                                                ^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 870, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 855, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask_cors\decorator.py", line 130, in wrapped_function
    resp = make_response(f(*args, **kwargs))
                         ^^^^^^^^^^^^^^^^^^
  File "e:\e_downloads\annotate-lab-issue-66\server\app.py", line 554, in download_yolo_annotations
    os.remove(temp_file)
PermissionError: [WinError 32] O arquivo já está sendo usado por outro processo: 'IMG_20230819_162654_HDR.txt'
127.0.0.1 - - [20/Jun/2024 23:42:17] "POST /download_yolo_annotations HTTP/1.1" 500 -
Annotations: []
Annotations: []
Temp file: IMG_20230819_162635_HDR.txt
[2024-06-20 23:42:19,882] ERROR in app: Exception on /download_yolo_annotations [POST]
Traceback (most recent call last):
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 1463, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 872, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask_cors\extension.py", line 178, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
                                                ^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 870, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 855, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask_cors\decorator.py", line 130, in wrapped_function
    resp = make_response(f(*args, **kwargs))
                         ^^^^^^^^^^^^^^^^^^
  File "e:\e_downloads\annotate-lab-issue-66\server\app.py", line 554, in download_yolo_annotations
    os.remove(temp_file)
PermissionError: [WinError 32] O arquivo já está sendo usado por outro processo: 'IMG_20230819_162635_HDR.txt'
127.0.0.1 - - [20/Jun/2024 23:42:19] "POST /download_yolo_annotations HTTP/1.1" 500 -
127.0.0.1 - - [20/Jun/2024 23:42:25] "OPTIONS /save HTTP/1.1" 200 -
Database:                   image-name selected-classes comment image-original-height image-original-width                                          image-src processed
0  [IMG_20230819_162654_HDR]         [cherry]      []                [2400]               [2400]  [http://127.0.0.1:5000/uploads/IMG_20230819_16...       [1]
1  [IMG_20230819_162635_HDR]               []      []                [2400]               [2400]  [http://127.0.0.1:5000/uploads/IMG_20230819_16...       [1]
2  [IMG_20230819_162644_HDR]               []      []                [2400]               [2400]  [http://127.0.0.1:5000/uploads/IMG_20230819_16...       [1]
3  [IMG_20230819_162644_HDR]               []      []                [2400]               [2400]  [http://127.0.0.1:5000/uploads/IMG_20230819_16...       [1]
4  [IMG_20230819_162644_HDR]               []      []                [2400]               [2400]  [http://127.0.0.1:5000/uploads/IMG_20230819_16...       [1]
Adding new data to database: {'image-name': ['IMG_20230819_162635_HDR'], 'image-src': ['http://127.0.0.1:5000/uploads/IMG_20230819_162635_HDR.jpg'], 'comment': [''], 'selected-classes': [''], 'image-original-height': [2400], 'image-original-width': [2400], 'processed': [1]}
Database:            region-id                                          image-src   class comment tags                      x                  y                     w                     h
0  29635746783475514  http://127.0.0.1:5000/uploads/IMG_20230819_162...  cherry               [0.19230769230769232]  [0.2053588801979]  [0.5341880341880343]  [0.5235042735042736]
Adding new data to database: {'region-id': '6912780530518177', 'image-src': 'http://127.0.0.1:5000/uploads/IMG_20230819_162635_HDR.jpg', 'class': 'cherry', 'comment': '', 'tags': '', 'x': [0.1495726495726496], 'y': [0.27587170071072054], 'w': [0.5833333333333334], 'h': [0.4551282051282052]}
127.0.0.1 - - [20/Jun/2024 23:42:25] "POST /save HTTP/1.1" 200 -
127.0.0.1 - - [20/Jun/2024 23:42:30] "OPTIONS /download_yolo_annotations HTTP/1.1" 200 -
Annotations: ['cherry 1058.974358974359 1208.2459278595754 1400.0 1092.3076923076924']
Annotations: ['cherry 1058.974358974359 1208.2459278595754 1400.0 1092.3076923076924']
Temp file: IMG_20230819_162635_HDR.txt
[2024-06-20 23:42:30,239] ERROR in app: Exception on /download_yolo_annotations [POST]
Traceback (most recent call last):
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 1463, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 872, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask_cors\extension.py", line 178, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
                                                ^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 870, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 855, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask_cors\decorator.py", line 130, in wrapped_function
    resp = make_response(f(*args, **kwargs))
                         ^^^^^^^^^^^^^^^^^^
  File "e:\e_downloads\annotate-lab-issue-66\server\app.py", line 554, in download_yolo_annotations
    os.remove(temp_file)
PermissionError: [WinError 32] O arquivo já está sendo usado por outro processo: 'IMG_20230819_162635_HDR.txt'
127.0.0.1 - - [20/Jun/2024 23:42:30] "POST /download_yolo_annotations HTTP/1.1" 500 -
Annotations: ['cherry 1058.974358974359 1208.2459278595754 1400.0 1092.3076923076924']
Annotations: ['cherry 1058.974358974359 1208.2459278595754 1400.0 1092.3076923076924']
Temp file: IMG_20230819_162635_HDR.txt
[2024-06-20 23:42:31,272] ERROR in app: Exception on /download_yolo_annotations [POST]
Traceback (most recent call last):
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 1463, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 872, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask_cors\extension.py", line 178, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
                                                ^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 870, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 855, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask_cors\decorator.py", line 130, in wrapped_function
    resp = make_response(f(*args, **kwargs))
                         ^^^^^^^^^^^^^^^^^^
  File "e:\e_downloads\annotate-lab-issue-66\server\app.py", line 554, in download_yolo_annotations
    os.remove(temp_file)
PermissionError: [WinError 32] O arquivo já está sendo usado por outro processo: 'IMG_20230819_162635_HDR.txt'
127.0.0.1 - - [20/Jun/2024 23:42:31] "POST /download_yolo_annotations HTTP/1.1" 500 -
Annotations: ['cherry 1058.974358974359 1208.2459278595754 1400.0 1092.3076923076924']
Annotations: ['cherry 1058.974358974359 1208.2459278595754 1400.0 1092.3076923076924']
Temp file: IMG_20230819_162635_HDR.txt
[2024-06-20 23:42:31,512] ERROR in app: Exception on /download_yolo_annotations [POST]
Traceback (most recent call last):
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 1463, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 872, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask_cors\extension.py", line 178, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
                                                ^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 870, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 855, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask_cors\decorator.py", line 130, in wrapped_function
    resp = make_response(f(*args, **kwargs))
                         ^^^^^^^^^^^^^^^^^^
  File "e:\e_downloads\annotate-lab-issue-66\server\app.py", line 554, in download_yolo_annotations
    os.remove(temp_file)
PermissionError: [WinError 32] O arquivo já está sendo usado por outro processo: 'IMG_20230819_162635_HDR.txt'
127.0.0.1 - - [20/Jun/2024 23:42:31] "POST /download_yolo_annotations HTTP/1.1" 500 -
Annotations: ['cherry 1058.974358974359 1208.2459278595754 1400.0 1092.3076923076924']
Annotations: ['cherry 1058.974358974359 1208.2459278595754 1400.0 1092.3076923076924']
Temp file: IMG_20230819_162635_HDR.txt
[2024-06-20 23:42:31,688] ERROR in app: Exception on /download_yolo_annotations [POST]
Traceback (most recent call last):
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 1463, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 872, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask_cors\extension.py", line 178, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
                                                ^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 870, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 855, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask_cors\decorator.py", line 130, in wrapped_function
    resp = make_response(f(*args, **kwargs))
                         ^^^^^^^^^^^^^^^^^^
  File "e:\e_downloads\annotate-lab-issue-66\server\app.py", line 554, in download_yolo_annotations
    os.remove(temp_file)
PermissionError: [WinError 32] O arquivo já está sendo usado por outro processo: 'IMG_20230819_162635_HDR.txt'
127.0.0.1 - - [20/Jun/2024 23:42:31] "POST /download_yolo_annotations HTTP/1.1" 500 -
Annotations: ['cherry 1058.974358974359 1208.2459278595754 1400.0 1092.3076923076924']
Annotations: ['cherry 1058.974358974359 1208.2459278595754 1400.0 1092.3076923076924']
Temp file: IMG_20230819_162635_HDR.txt
[2024-06-20 23:42:31,860] ERROR in app: Exception on /download_yolo_annotations [POST]
Traceback (most recent call last):
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 1463, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 872, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask_cors\extension.py", line 178, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
                                                ^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 870, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 855, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask_cors\decorator.py", line 130, in wrapped_function
    resp = make_response(f(*args, **kwargs))
                         ^^^^^^^^^^^^^^^^^^
  File "e:\e_downloads\annotate-lab-issue-66\server\app.py", line 554, in download_yolo_annotations
    os.remove(temp_file)
PermissionError: [WinError 32] O arquivo já está sendo usado por outro processo: 'IMG_20230819_162635_HDR.txt'
127.0.0.1 - - [20/Jun/2024 23:42:31] "POST /download_yolo_annotations HTTP/1.1" 500 -
Annotations: ['cherry 1058.974358974359 1208.2459278595754 1400.0 1092.3076923076924']
Annotations: ['cherry 1058.974358974359 1208.2459278595754 1400.0 1092.3076923076924']
Temp file: IMG_20230819_162635_HDR.txt
[2024-06-20 23:42:32,031] ERROR in app: Exception on /download_yolo_annotations [POST]
Traceback (most recent call last):
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 1463, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 872, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask_cors\extension.py", line 178, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
                                                ^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 870, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 855, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask_cors\decorator.py", line 130, in wrapped_function
    resp = make_response(f(*args, **kwargs))
                         ^^^^^^^^^^^^^^^^^^
  File "e:\e_downloads\annotate-lab-issue-66\server\app.py", line 554, in download_yolo_annotations
    os.remove(temp_file)
PermissionError: [WinError 32] O arquivo já está sendo usado por outro processo: 'IMG_20230819_162635_HDR.txt'
127.0.0.1 - - [20/Jun/2024 23:42:32] "POST /download_yolo_annotations HTTP/1.1" 500 -
Annotations: ['cherry 1058.974358974359 1208.2459278595754 1400.0 1092.3076923076924']
Annotations: ['cherry 1058.974358974359 1208.2459278595754 1400.0 1092.3076923076924']
Temp file: IMG_20230819_162635_HDR.txt
[2024-06-20 23:42:32,208] ERROR in app: Exception on /download_yolo_annotations [POST]
Traceback (most recent call last):
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 1463, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 872, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask_cors\extension.py", line 178, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
                                                ^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 870, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask\app.py", line 855, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\leand\AppData\Roaming\Python\Python312\site-packages\flask_cors\decorator.py", line 130, in wrapped_function
    resp = make_response(f(*args, **kwargs))
                         ^^^^^^^^^^^^^^^^^^
  File "e:\e_downloads\annotate-lab-issue-66\server\app.py", line 554, in download_yolo_annotations
    os.remove(temp_file)
PermissionError: [WinError 32] O arquivo já está sendo usado por outro processo: 'IMG_20230819_162635_HDR.txt'
127.0.0.1 - - [20/Jun/2024 23:42:32] "POST /download_yolo_annotations HTTP/1.1" 500 -

@sumn2u
Copy link
Owner

sumn2u commented Jun 21, 2024

@leo-smi I see a permission error message in your server log. Can you provide the necessary permission?

PermissionError: [WinError 32] O arquivo já está sendo usado por outro processo: 'IMG_20230819_162635_HDR.txt'
127.0.0.1 - - [20/Jun/2024 23:42:32] "POST /download_yolo_annotations HTTP/1.1" 500 -

@leo-smi
Copy link
Author

leo-smi commented Jun 21, 2024

Sorry, I have no idea how to do this.

Actually I have 3 files but one of them is empty:

image

the annotation looks good:

cherry 1102.5641025641025 1121.0664406800884 1282.0512820512822 1256.4102564102568

@sumn2u
Copy link
Owner

sumn2u commented Jun 21, 2024

The temp file permission issue has been resolved, and the YOLO annotation format has been merged into the master branch.

@sumn2u sumn2u closed this as completed Jun 21, 2024
@leo-smi
Copy link
Author

leo-smi commented Jun 21, 2024

ERROR WHEN DOWNLOAD ANNOTATED IMAGE (THE ANNOTATIONS DOWNLOADING IS WORKING FINE):

image

PYTHON ERROR:

(base) PS E:\e_downloads\annotate-lab-master\server> & E:/Programas/PYTHON/Python3.12.2/python.exe e:/e_downloads/annotate-lab-master/server/app.py
 * Tip: There are .env or .flaskenv files present. Do "pip install python-dotenv" to use them.
 * Serving Flask app 'app'
 * Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on http://127.0.0.1:5000
Press CTRL+C to quit
127.0.0.1 - - [21/Jun/2024 11:38:15] "OPTIONS /upload HTTP/1.1" 200 -
127.0.0.1 - - [21/Jun/2024 11:38:15] "POST /upload HTTP/1.1" 201 -
127.0.0.1 - - [21/Jun/2024 11:38:16] "GET /uploads/IMG_20230819_162644_HDR.jpg HTTP/1.1" 200 -
127.0.0.1 - - [21/Jun/2024 11:38:16] "GET /uploads/IMG_20230819_162635_HDR.jpg HTTP/1.1" 200 -
127.0.0.1 - - [21/Jun/2024 11:38:17] "GET /uploads/IMG_20230819_162644_HDR.jpg HTTP/1.1" 304 -
127.0.0.1 - - [21/Jun/2024 11:38:17] "GET /uploads/IMG_20230819_162635_HDR.jpg HTTP/1.1" 304 -
127.0.0.1 - - [21/Jun/2024 11:38:17] "GET /uploads/IMG_20230819_162644_HDR.jpg HTTP/1.1" 304 -
127.0.0.1 - - [21/Jun/2024 11:38:29] "OPTIONS /activeImage HTTP/1.1" 200 -
Database: Empty DataFrame
Columns: [image-name, selected-classes, comment, image-original-height, image-original-width, image-src, processed]
Index: []
Adding new data to database: {'image-name': ['IMG_20230819_162644_HDR'], 'image-src': ['http://127.0.0.1:5000/uploads/IMG_20230819_162644_HDR.jpg'], 'comment': [''], 'selected-classes': ['CHERRY'], 'image-original-height': [2400], 'image-original-width': [2400], 'processed': [1]}
selected class: CHERRY
adding image ('IMG_20230819_162644_HDR', '.jpg') to category CHERRY with base name IMG_20230819_162644_HDR.jpg
127.0.0.1 - - [21/Jun/2024 11:38:29] "POST /activeImage HTTP/1.1" 200 -
127.0.0.1 - - [21/Jun/2024 11:38:30] "GET /uploads/IMG_20230819_162635_HDR.jpg HTTP/1.1" 304 -
127.0.0.1 - - [21/Jun/2024 11:38:35] "OPTIONS /activeImage HTTP/1.1" 200 -
Database:                   image-name selected-classes comment image-original-height image-original-width                                          image-src processed
0  [IMG_20230819_162644_HDR]         [CHERRY]      []                [2400]               [2400]  [http://127.0.0.1:5000/uploads/IMG_20230819_16...       [1]
Adding new data to database: {'image-name': ['IMG_20230819_162635_HDR'], 'image-src': ['http://127.0.0.1:5000/uploads/IMG_20230819_162635_HDR.jpg'], 'comment': [''], 'selected-classes': [''], 'image-original-height': [2400], 'image-original-width': [2400], 'processed': [1]}
127.0.0.1 - - [21/Jun/2024 11:38:35] "POST /activeImage HTTP/1.1" 200 -
127.0.0.1 - - [21/Jun/2024 11:38:37] "OPTIONS /save HTTP/1.1" 200 -
Database:                   image-name selected-classes comment image-original-height image-original-width                                          image-src processed
0  [IMG_20230819_162644_HDR]         [CHERRY]      []                [2400]               [2400]  [http://127.0.0.1:5000/uploads/IMG_20230819_16...       [1]
1  [IMG_20230819_162635_HDR]               []      []                [2400]               [2400]  [http://127.0.0.1:5000/uploads/IMG_20230819_16...       [1]
Adding new data to database: {'image-name': ['IMG_20230819_162635_HDR'], 'image-src': ['http://127.0.0.1:5000/uploads/IMG_20230819_162635_HDR.jpg'], 'comment': [''], 'selected-classes': [''], 'image-original-height': [2400], 'image-original-width': [2400], 'processed': [1]}
Database: Empty DataFrame
Columns: [region-id, image-src, class, comment, tags, x, y, w, h]
Index: []
Adding new data to database: {'region-id': '22330844346515777', 'image-src': 'http://127.0.0.1:5000/uploads/IMG_20230819_162635_HDR.jpg', 'class': 'CHERRY', 'comment': '', 'tags': '', 'x': [0.10470085470085472], 'y': [0.2801452049842248], 'w': [0.6324786324786325], 'h': [0.4658119658119658]}
127.0.0.1 - - [21/Jun/2024 11:38:37] "POST /save HTTP/1.1" 200 -
127.0.0.1 - - [21/Jun/2024 11:38:39] "OPTIONS /download_yolo_annotations HTTP/1.1" 200 -
Annotations: ['CHERRY 1010.2564102564102 1231.3228509364985 1517.9487179487178 1117.948717948718']
Annotations: ['CHERRY 1010.2564102564102 1231.3228509364985 1517.9487179487178 1117.948717948718']
Temp file: IMG_20230819_162635_HDR.txt
127.0.0.1 - - [21/Jun/2024 11:38:39] "POST /download_yolo_annotations HTTP/1.1" 200 -
127.0.0.1 - - [21/Jun/2024 11:39:27] "OPTIONS /save HTTP/1.1" 200 -
Database:                   image-name selected-classes comment image-original-height image-original-width                                          image-src processed
0  [IMG_20230819_162644_HDR]         [CHERRY]      []                [2400]               [2400]  [http://127.0.0.1:5000/uploads/IMG_20230819_16...       [1]
1  [IMG_20230819_162635_HDR]               []      []                [2400]               [2400]  [http://127.0.0.1:5000/uploads/IMG_20230819_16...       [1]
2  [IMG_20230819_162635_HDR]               []      []                [2400]               [2400]  [http://127.0.0.1:5000/uploads/IMG_20230819_16...       [1]
Adding new data to database: {'image-name': ['IMG_20230819_162635_HDR'], 'image-src': ['http://127.0.0.1:5000/uploads/IMG_20230819_162635_HDR.jpg'], 'comment': [''], 'selected-classes': [''], 'image-original-height': [2400], 'image-original-width': [2400], 'processed': [1]}
Database:            region-id                                          image-src   class comment tags                      x                     y                     w                     h
0  22330844346515777  http://127.0.0.1:5000/uploads/IMG_20230819_162...  CHERRY               [0.10470085470085472]  [0.2801452049842248]  [0.6324786324786325]  [0.4658119658119658]
Updating existing data in database: {'region-id': '22330844346515777', 'image-src': 'http://127.0.0.1:5000/uploads/IMG_20230819_162635_HDR.jpg', 'class': 'CHERRY', 'comment': '', 'tags': '', 'x': [0.10470085470085472], 'y': [0.2801452049842248], 'w': [0.6324786324786325], 'h': [0.4658119658119658]}
selected_classes_str: CHERRY
127.0.0.1 - - [21/Jun/2024 11:39:27] "POST /save HTTP/1.1" 200 -
127.0.0.1 - - [21/Jun/2024 11:39:32] "OPTIONS /download_image_with_annotations HTTP/1.1" 200 -
127.0.0.1 - - [21/Jun/2024 11:39:32] "GET /uploads/IMG_20230819_162635_HDR.jpg HTTP/1.1" 200 -
127.0.0.1 - - [21/Jun/2024 11:39:33] "POST /download_image_with_annotations HTTP/1.1" 200 -
127.0.0.1 - - [21/Jun/2024 11:39:47] "GET /uploads/IMG_20230819_162644_HDR.jpg HTTP/1.1" 304 -
127.0.0.1 - - [21/Jun/2024 11:39:53] "OPTIONS /download_yolo_annotations HTTP/1.1" 200 -
Annotations: []
Annotations: []
Temp file: IMG_20230819_162644_HDR.txt
127.0.0.1 - - [21/Jun/2024 11:39:53] "POST /download_yolo_annotations HTTP/1.1" 200 -
127.0.0.1 - - [21/Jun/2024 11:40:02] "OPTIONS /download_image_with_annotations HTTP/1.1" 200 -
General error: list index out of range
Traceback (most recent call last):
  File "e:\e_downloads\annotate-lab-master\server\app.py", line 285, in download_image_with_annotations
    image_url = image_info.get("regions", [])[0].get("image-src")
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
127.0.0.1 - - [21/Jun/2024 11:40:02] "POST /download_image_with_annotations HTTP/1.1" 500 -
127.0.0.1 - - [21/Jun/2024 11:40:07] "OPTIONS /download_image_with_annotations HTTP/1.1" 200 -
General error: list index out of range
Traceback (most recent call last):
  File "e:\e_downloads\annotate-lab-master\server\app.py", line 285, in download_image_with_annotations
    image_url = image_info.get("regions", [])[0].get("image-src")
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
127.0.0.1 - - [21/Jun/2024 11:40:07] "POST /download_image_with_annotations HTTP/1.1" 500 -
127.0.0.1 - - [21/Jun/2024 11:40:09] "GET /uploads/IMG_20230819_162635_HDR.jpg HTTP/1.1" 304 -
General error: list index out of range
Traceback (most recent call last):
  File "e:\e_downloads\annotate-lab-master\server\app.py", line 285, in download_image_with_annotations
    image_url = image_info.get("regions", [])[0].get("image-src")
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
127.0.0.1 - - [21/Jun/2024 11:40:11] "POST /download_image_with_annotations HTTP/1.1" 500 -
127.0.0.1 - - [21/Jun/2024 11:40:48] "OPTIONS /download_image_with_annotations HTTP/1.1" 200 -
General error: list index out of range
Traceback (most recent call last):
  File "e:\e_downloads\annotate-lab-master\server\app.py", line 285, in download_image_with_annotations
    image_url = image_info.get("regions", [])[0].get("image-src")
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
127.0.0.1 - - [21/Jun/2024 11:40:48] "POST /download_image_with_annotations HTTP/1.1" 500 -
(base) PS E:\e_downloads\annotate-lab-master\server> 

SUGGESTION: ADD BULK DOWNLOAD TO DOWNLOAD ALL IMAGES AND ANNOTATION AT SAME TIME.

@sumn2u
Copy link
Owner

sumn2u commented Jun 21, 2024

Thanks @leo-smi for the suggestion. I created a separate ticket (#73) for it. It might take a couple of days to implement.

I'm trying to replicate the error but haven't been able to do so. :(

Here's a link to our Slack channel. Can you join us and help replicate the issue?

@sumn2u
Copy link
Owner

sumn2u commented Jun 23, 2024

@leo-smi The bulk download feature is now supported.

@leo-smi
Copy link
Author

leo-smi commented Jun 23, 2024

Hi, thank you for your effort. The downloads is now working fine but I notice something and I have another suggestions:

  • The images are downloading indivually even in a zip format so I suggest download the files all at once in the format:

image

put all the files (data folder) in a zip file to download.

source: https://medium.com/@KaziMushfiq1234/train-yolov8-on-a-custom-dataset-for-object-detection-on-local-machine-using-python-6a402a2968de

@sumn2u
Copy link
Owner

sumn2u commented Jun 23, 2024

@leo-smi Thanks for checking in. Please ensure that you have checked the checkboxes next to the files to indicate which ones need to be downloaded. Can you confirm that all the images were checked?

Screenshot 2024-06-23 at 5 03 29 PM

@sumn2u
Copy link
Owner

sumn2u commented Jun 23, 2024

And also you are using the master branch?

@leo-smi
Copy link
Author

leo-smi commented Jun 23, 2024

Yes, I have checked every box, and the result was:

image

@sumn2u
Copy link
Owner

sumn2u commented Jun 23, 2024

Is it possible to attach the screenshot of checked files too?

@sumn2u
Copy link
Owner

sumn2u commented Jun 23, 2024

@leo-smi Think your code is out of sync with current changes. The downloaded file should be images_with_annotations.zip. Can you pull the latest changes (master branch) and try it?

@leo-smi
Copy link
Author

leo-smi commented Jun 24, 2024

Is it possible to attach the screenshot of checked files too?

image

@leo-smi
Copy link
Author

leo-smi commented Jun 24, 2024

@leo-smi Think your code is out of sync with current changes. The downloaded file should be images_with_annotations.zip. Can you pull the latest changes (master branch) and try it?

(base) PS E:\e_downloads\annotate-lab-master\server> & E:/Programas/PYTHON/Python3.12.2/python.exe e:/e_downloads/annotate-lab-master/server/app.py
 * Tip: There are .env or .flaskenv files present. Do "pip install python-dotenv" to use them.
 * Serving Flask app 'app'
 * Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on http://127.0.0.1:5000
Press CTRL+C to quit
127.0.0.1 - - [23/Jun/2024 21:26:37] "GET /uploads/IMG_20230819_162644_HDR.jpg HTTP/1.1" 404 -
127.0.0.1 - - [23/Jun/2024 21:26:37] "GET /uploads/IMG_20230819_162635_HDR.jpg HTTP/1.1" 404 -
127.0.0.1 - - [23/Jun/2024 21:26:40] "OPTIONS /upload HTTP/1.1" 200 -
127.0.0.1 - - [23/Jun/2024 21:26:40] "POST /upload HTTP/1.1" 201 -
127.0.0.1 - - [23/Jun/2024 21:26:40] "GET /uploads/IMG_20230819_162635_HDR.jpg HTTP/1.1" 200 -
127.0.0.1 - - [23/Jun/2024 21:26:40] "GET /uploads/IMG_20230819_162644_HDR.jpg HTTP/1.1" 200 -
127.0.0.1 - - [23/Jun/2024 21:26:42] "GET /uploads/IMG_20230819_162635_HDR.jpg HTTP/1.1" 304 -
127.0.0.1 - - [23/Jun/2024 21:26:42] "GET /uploads/IMG_20230819_162644_HDR.jpg HTTP/1.1" 304 -
127.0.0.1 - - [23/Jun/2024 21:26:42] "GET /uploads/IMG_20230819_162635_HDR.jpg HTTP/1.1" 304 -
127.0.0.1 - - [23/Jun/2024 21:26:44] "GET /uploads/IMG_20230819_162644_HDR.jpg HTTP/1.1" 304 -
127.0.0.1 - - [23/Jun/2024 21:26:45] "GET /uploads/IMG_20230819_162635_HDR.jpg HTTP/1.1" 304 -
127.0.0.1 - - [23/Jun/2024 21:26:56] "GET /uploads/IMG_20230819_162644_HDR.jpg HTTP/1.1" 304 -
127.0.0.1 - - [23/Jun/2024 21:27:05] "OPTIONS /save HTTP/1.1" 200 -
Database: Empty DataFrame
Columns: [image-name, selected-classes, comment, image-original-height, image-original-width, image-src, processed]
Index: []
Adding new data to database: {'image-name': ['IMG_20230819_162644_HDR'], 'image-src': ['http://127.0.0.1:5000/uploads/IMG_20230819_162644_HDR.jpg'], 'comment': [''], 'selected-classes': [''], 'image-original-height': [2400], 'image-original-width': [2400], 'processed': [1]}
Database: Empty DataFrame
Columns: [region-id, image-src, class, comment, tags, x, y, w, h]
Index: []
Adding new data to database: {'region-id': '9242997434494764', 'image-src': 'http://127.0.0.1:5000/uploads/IMG_20230819_162644_HDR.jpg', 'class': 'CHERRY', 'comment': '', 'tags': '', 'x': [0.17948717948717952], 'y': [0.19040161524063504], 'w': [0.5876068376068376], 'h': [0.5619658119658121]}
127.0.0.1 - - [23/Jun/2024 21:27:05] "POST /save HTTP/1.1" 200 -
127.0.0.1 - - [23/Jun/2024 21:27:08] "OPTIONS /download_yolo_annotations HTTP/1.1" 200 -
Annotations: ['CHERRY 1135.897435897436 1131.3228509364985 1410.2564102564104 1348.717948717949']
Annotations: ['CHERRY 1135.897435897436 1131.3228509364985 1410.2564102564104 1348.717948717949']
Temp file: <tempfile._TemporaryFileWrapper object at 0x0000023C1B764FE0>
Error deleting temporary file: [WinError 32] O arquivo já está sendo usado por outro processo: 'C:\\Users\\leand\\AppData\\Local\\Temp\\tmpv5ekwfb7'
127.0.0.1 - - [23/Jun/2024 21:27:08] "POST /download_yolo_annotations HTTP/1.1" 200 -
127.0.0.1 - - [23/Jun/2024 21:27:26] "OPTIONS /download_configuration HTTP/1.1" 200 -
127.0.0.1 - - [23/Jun/2024 21:27:26] "POST /download_configuration HTTP/1.1" 200 -
127.0.0.1 - - [23/Jun/2024 21:27:47] "OPTIONS /download_yolo_annotations HTTP/1.1" 200 -
Annotations: ['CHERRY 1135.897435897436 1131.3228509364985 1410.2564102564104 1348.717948717949']
Annotations: ['CHERRY 1135.897435897436 1131.3228509364985 1410.2564102564104 1348.717948717949']
Temp file: <tempfile._TemporaryFileWrapper object at 0x0000023C1B85A180>
Error deleting temporary file: [WinError 32] O arquivo já está sendo usado por outro processo: 'C:\\Users\\leand\\AppData\\Local\\Temp\\tmpigm1ali6'
127.0.0.1 - - [23/Jun/2024 21:27:47] "POST /download_yolo_annotations HTTP/1.1" 200 -
127.0.0.1 - - [23/Jun/2024 21:27:53] "OPTIONS /download_image_with_annotations HTTP/1.1" 200 -
127.0.0.1 - - [23/Jun/2024 21:27:53] "GET /uploads/IMG_20230819_162644_HDR.jpg HTTP/1.1" 200 -
127.0.0.1 - - [23/Jun/2024 21:27:54] "POST /download_image_with_annotations HTTP/1.1" 200 -

@sumn2u
Copy link
Owner

sumn2u commented Jun 24, 2024

Thanks. I recently pushed to the master branch. Could you pull it and run it?

After annotating, please click the checkbox and then the save icon for each image, followed by clicking the download button, as shown in this video:

sample_example.mov

@leo-smi
Copy link
Author

leo-smi commented Jun 24, 2024

Thanks. I recently pushed to the master branch. Could you pull it and run it?

After annotating, please click the checkbox and then the save icon for each image, followed by clicking the download button, as shown in this video:

sample_example.mov

Thank you, it's working!

image

@leo-smi
Copy link
Author

leo-smi commented Jun 25, 2024

I tested the annotation bulk download and it's not working properly. Only downloads one file without the train image name identification:

I think the label should be a number instead a word (to match the .yaml file), for example:

path: .  
train: ./images/train/  
val: ./images/val/  

names:
  0: fifty
  1: stop
  2: unlimited
  3: walk

image
image
image

see more: https://www.basic.ai/blog-post/data-annotation-for-yolo-model-training-techniques-and-best-practices-1

@sumn2u
Copy link
Owner

sumn2u commented Jun 26, 2024

Regarding the numeric values, I believe they are using one-hot encoding. Currently, we don't have that mapping functionality.

We can add it to the roadmap, but that will take some time. Another option is to handle the mapping through post-processing.

@leo-smi
Copy link
Author

leo-smi commented Jun 26, 2024

Regarding the numeric values, I believe they are using one-hot encoding. Currently, we don't have that mapping functionality.

We can add it to the roadmap, but that will take some time. Another option is to handle the mapping through post-processing.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants