33 StructField ,
44 StringType ,
55 IntegerType ,
6- FloatType ,
76 BooleanType ,
87 MapType ,
98 ArrayType
109)
11- from .comment import get_comment_schema
12-
13-
14- def get_point_schema ():
15- point_schema = StructType ([
16- StructField ("x" , FloatType (), True ),
17- StructField ("y" , FloatType (), True )
18- ])
19- return point_schema
20-
21-
22- def get_cuboid_schema ():
23- cuboid_points_schema = StructType ([
24- StructField ("f1" , get_point_schema (), True ),
25- StructField ("f2" , get_point_schema (), True ),
26- StructField ("r1" , get_point_schema (), True ),
27- StructField ("r2" , get_point_schema (), True )
28- ])
29- return cuboid_points_schema
10+ from .comment import get_vector_comment_schema
11+ from .shapes import (
12+ get_point_schema ,
13+ get_cuboid_schema ,
14+ get_bbox_schema ,
15+ get_ellipse_schema ,
16+ get_polygon_schema ,
17+ get_polyline_schema ,
18+ get_rbbox_schema
19+ )
20+ from .tag import get_tag_schema
3021
3122
3223def get_vector_instance_schema ():
33- instance_schema = StructType ([
24+ return StructType ([
3425 StructField ("instance_type" , StringType (), True ),
3526 StructField ("classId" , IntegerType (), True ),
3627 StructField ("probability" , IntegerType (), True ),
37- StructField ("bbox_points" , MapType (StringType (), FloatType ()), True ),
38- StructField ("polygon_points" , ArrayType (FloatType ()), True ),
39- StructField ("polygon_exclude" , ArrayType (ArrayType (FloatType ())),
40- True ),
41- StructField ("cuboid_points" , get_cuboid_schema (), True ),
42- StructField ("ellipse_points" , MapType (StringType (), FloatType ()),
43- True ),
44- StructField ("point_points" , MapType (StringType (), FloatType ()), True ),
28+ StructField ("bbox" , get_bbox_schema (), True ),
29+ StructField ("rbbox" , get_rbbox_schema (), True ),
30+ StructField ("polygon" , get_polygon_schema ()),
31+ StructField ("cuboid" , get_cuboid_schema (), True ),
32+ StructField ("ellipse" , get_ellipse_schema (), True ),
33+ StructField ("polyline" , get_polyline_schema (), True ),
34+ StructField ("point" , get_point_schema (), True ),
4535 StructField ("groupId" , IntegerType (), True ),
4636 StructField ("locked" , BooleanType (), True ),
4737 StructField ("attributes" , ArrayType (MapType (StringType (),
@@ -56,24 +46,6 @@ def get_vector_instance_schema():
5646 StructField ("updatedBy" , MapType (StringType (), StringType ()), True ),
5747 StructField ("className" , StringType (), True )
5848 ])
59- return instance_schema
60-
61-
62- def get_vector_tag_schema ():
63- schema = StructType ([
64- StructField ("instance_type" , StringType (), True ),
65- StructField ("classId" , IntegerType (), True ),
66- StructField ("probability" , IntegerType (), True ),
67- StructField ("attributes" , ArrayType (MapType (StringType (),
68- StringType ())),
69- True ),
70- StructField ("createdAt" , StringType (), True ),
71- StructField ("createdBy" , MapType (StringType (), StringType ()), True ),
72- StructField ("creationType" , StringType (), True ),
73- StructField ("updatedAt" , StringType (), True ),
74- StructField ("updatedBy" , MapType (StringType (), StringType ()), True ),
75- StructField ("className" , StringType (), True )])
76- return schema
7749
7850
7951def get_vector_schema ():
@@ -90,7 +62,7 @@ def get_vector_schema():
9062 StructField ("instances" , ArrayType (get_vector_instance_schema ()),
9163 True ),
9264 StructField ("bounding_boxes" , ArrayType (IntegerType ()), True ),
93- StructField ("comments" , ArrayType (get_comment_schema ()), True ),
94- StructField ("tags" , ArrayType (get_vector_tag_schema ()), True )
65+ StructField ("comments" , ArrayType (get_vector_comment_schema ()), True ),
66+ StructField ("tags" , ArrayType (get_tag_schema ()), True )
9567 ])
9668 return schema
0 commit comments