Web platform for sharing free image data for ML and research

Homepage: https://datasets.roundabout-host.com

By using this site, you agree to have cookies stored on your device, strictly for functional purposes, such as storing your session and preferences.

Dismiss

Fix a few critical issues

roundabout,
created on Wednesday, 2 April 2025, 09:21:55 (1743585715), received on Wednesday, 2 April 2025, 09:21:59 (1743585719)
Author identity: vlad <vlad.muntoiu@gmail.com>

b693c5ea8da31870fc85aa942f1d19e0fc54e806

static/picture-annotation.py

@@ -81,10 +81,10 @@ def list_shapes():

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    if shape.tagName == "rect":
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        shape_dict["type"] = "bbox"
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        shape_dict["shape"] = {
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                        "x": float(shape.getAttribute("x")[:-1]) / 100,
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                        "y": float(shape.getAttribute("y")[:-1]) / 100,
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                        "w": float(shape.getAttribute("width")[:-1]) / 100,
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                        "h": float(shape.getAttribute("height")[:-1]) / 100
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                        "x": float(shape.getAttribute("x")[:-1]),
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                        "y": float(shape.getAttribute("y")[:-1]),
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                        "w": float(shape.getAttribute("width")[:-1]),
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                        "h": float(shape.getAttribute("height")[:-1])
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        }
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    elif shape.tagName == "polygon" or shape.tagName == "polyline":
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        if shape.tagName == "polygon":
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        

@@ -168,7 +168,7 @@ async def load_shapes():

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            async def save_shapes(event):
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                shapes = list_shapes()
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                resource_id = document.getElementById("resource-id").value
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            print("Saving shapes:", shapes)
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            #print("Saving shapes:", shapes)
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                response = await pyfetch(f"/picture/{resource_id}/save-annotations",
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    method="POST",
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    headers={
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        

@@ -176,8 +176,6 @@ async def save_shapes(event):

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    },
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    body=json.dumps(shapes)
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                )
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            if response.ok:
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                return await response
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            save_shapes_proxy = create_proxy(save_shapes)
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        

@@ -607,7 +605,7 @@ def backspace_polygon(event):

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                polygon_points.pop()
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                polygon = new_shape.children[0]
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                polygon.setAttribute("points", " ".join(
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    [f"{point[0] * 100}%,{point[1] * 100}%" for point in
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    [f"{point[0]},{point[1]}" for point in
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                         polygon_points]))
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        

@@ -918,4 +916,4 @@ zoom_out_button.addEventListener("click", zoom_out)

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            # Load existing annotations, if any
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            put_shapes(await load_shapes())
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            update_transform()
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        print("Ready!")
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        print("Ready!")