@@ -70,3 +70,45 @@ def test_onnx_save(tmp_path, data):
7070 assert type (cls_model ) is type (deserialized )
7171 for attr in cls_model .parameters ():
7272 assert getattr (cls_model , attr ) == getattr (deserialized , attr )
73+
74+
75+ def test_padim_save (tmp_path , data ):
76+ padim_model = Model .create_model (
77+ Path (data ) / "anomalib_models/padim.xml" ,
78+ )
79+ xml_path = str (tmp_path / "a.xml" )
80+ padim_model .save (xml_path )
81+ deserialized = Model .create_model (xml_path )
82+
83+ assert not deserialized .get_model ().get_rt_info (["model_info" , "embedded_processing" ]).astype (bool )
84+ assert type (padim_model ) is type (deserialized )
85+ for attr in padim_model .parameters ():
86+ assert getattr (padim_model , attr ) == getattr (deserialized , attr )
87+
88+
89+ def test_stfpm_save (tmp_path , data ):
90+ stfpm_model = Model .create_model (
91+ Path (data ) / "anomalib_models/stfpm.xml" ,
92+ )
93+ xml_path = str (tmp_path / "a.xml" )
94+ stfpm_model .save (xml_path )
95+ deserialized = Model .create_model (xml_path )
96+
97+ assert not deserialized .get_model ().get_rt_info (["model_info" , "embedded_processing" ]).astype (bool )
98+ assert type (stfpm_model ) is type (deserialized )
99+ for attr in stfpm_model .parameters ():
100+ assert getattr (stfpm_model , attr ) == getattr (deserialized , attr )
101+
102+
103+ def test_uflow_save (tmp_path , data ):
104+ uflow_model = Model .create_model (
105+ Path (data ) / "anomalib_models/uflow.xml" ,
106+ )
107+ xml_path = str (tmp_path / "a.xml" )
108+ uflow_model .save (xml_path )
109+ deserialized = Model .create_model (xml_path )
110+
111+ assert not deserialized .get_model ().get_rt_info (["model_info" , "embedded_processing" ]).astype (bool )
112+ assert type (uflow_model ) is type (deserialized )
113+ for attr in uflow_model .parameters ():
114+ assert getattr (uflow_model , attr ) == getattr (deserialized , attr )
0 commit comments