@@ -103,3 +103,116 @@ def test_dir_parser(
103103 task_types = {get_task_type (task ) for task in ann }
104104 assert task_types == expected_task_types
105105 dataset .delete_dataset ()
106+
107+
108+ @pytest .mark .parametrize (
109+ ("url" , "dataset_type" , "expected_task_types" ),
110+ [
111+ (
112+ "COCO_people_subset.zip" ,
113+ "coco" ,
114+ {
115+ "boundingbox" ,
116+ "keypoints" ,
117+ "segmentation" ,
118+ "classification" ,
119+ "instance_segmentation" ,
120+ },
121+ ),
122+ (
123+ "Thermal_Dogs_and_People.v1-resize-416x416.coco.zip" ,
124+ "coco" ,
125+ {"boundingbox" , "classification" },
126+ ),
127+ (
128+ "roboflow://team-roboflow/coco-128/2/coco" ,
129+ "coco" ,
130+ {"boundingbox" , "classification" },
131+ ),
132+ (
133+ "Thermal_Dogs_and_People.v1-resize-416x416.voc.zip" ,
134+ "voc" ,
135+ {"boundingbox" , "classification" },
136+ ),
137+ (
138+ "Thermal_Dogs_and_People.v1-resize-416x416.darknet.zip" ,
139+ "darknet" ,
140+ {"boundingbox" , "classification" },
141+ ),
142+ (
143+ "Thermal_Dogs_and_People.v1-resize-416x416.yolov4pytorch.zip" ,
144+ "yolov4" ,
145+ {"boundingbox" , "classification" },
146+ ),
147+ (
148+ "Thermal_Dogs_and_People.v1-resize-416x416.mt-yolov6.zip" ,
149+ "yolov6" ,
150+ {"boundingbox" , "classification" },
151+ ),
152+ (
153+ "Thermal_Dogs_and_People.v1-resize-416x416.createml.zip" ,
154+ "createml" ,
155+ {"boundingbox" , "classification" },
156+ ),
157+ (
158+ "Thermal_Dogs_and_People.v1-resize-416x416.tensorflow.zip" ,
159+ "tfcsv" ,
160+ {"boundingbox" , "classification" },
161+ ),
162+ (
163+ "D2_Tile.png-mask-semantic.zip" ,
164+ "segmask" ,
165+ {"segmentation" , "classification" },
166+ ),
167+ (
168+ "Flowers_Classification.v2-raw.folder.zip" ,
169+ "clsdir" ,
170+ {"classification" },
171+ ),
172+ (
173+ "D2_ParkingLot.zip" ,
174+ "solo" ,
175+ {"boundingbox" , "segmentation" , "classification" , "keypoints" },
176+ ),
177+ (
178+ "D2_ParkingLot_Native.zip" ,
179+ "native" ,
180+ {
181+ "boundingbox" ,
182+ "instance_segmentation" ,
183+ "classification" ,
184+ "keypoints" ,
185+ "metadata/color" ,
186+ "metadata/brand" ,
187+ },
188+ ),
189+ ],
190+ )
191+ def test_dir_parser_explicit_type (
192+ dataset_name : str ,
193+ url : str ,
194+ dataset_type : str ,
195+ expected_task_types : set [str ],
196+ storage_url : str ,
197+ tempdir : Path ,
198+ ):
199+ if not url .startswith ("roboflow://" ):
200+ url = f"{ storage_url } /{ url } "
201+
202+ elif environ .ROBOFLOW_API_KEY is None :
203+ pytest .skip ("Roboflow API key is not set" )
204+
205+ parser = LuxonisParser (
206+ url ,
207+ dataset_name = dataset_name ,
208+ dataset_type = dataset_type , # type: ignore
209+ delete_local = True ,
210+ save_dir = tempdir ,
211+ )
212+ dataset = parser .parse ()
213+ assert len (dataset ) > 0
214+ loader = LuxonisLoader (dataset )
215+ _ , ann = next (iter (loader ))
216+ task_types = {get_task_type (task ) for task in ann }
217+ assert task_types == expected_task_types
218+ dataset .delete_dataset ()
0 commit comments