Best Python code snippet using autotest_python
models_test.py
Source:models_test.py
...27 window_stride_ms=10,28 feature_bin_count=40,29 preprocess="mfcc")30 def testPrepareModelSettings(self):31 self.assertIsNotNone(32 models.prepare_model_settings(33 label_count=10,34 sample_rate=16000,35 clip_duration_ms=1000,36 window_size_ms=20,37 window_stride_ms=10,38 feature_bin_count=40,39 preprocess="mfcc"))40 @test_util.run_deprecated_v141 def testCreateModelConvTraining(self):42 model_settings = self._modelSettings()43 with self.cached_session() as sess:44 fingerprint_input = tf.zeros([1, model_settings["fingerprint_size"]])45 logits, dropout_rate = models.create_model(46 fingerprint_input, model_settings, "conv", True)47 self.assertIsNotNone(logits)48 self.assertIsNotNone(dropout_rate)49 self.assertIsNotNone(sess.graph.get_tensor_by_name(logits.name))50 self.assertIsNotNone(sess.graph.get_tensor_by_name(dropout_rate.name))51 @test_util.run_deprecated_v152 def testCreateModelConvInference(self):53 model_settings = self._modelSettings()54 with self.cached_session() as sess:55 fingerprint_input = tf.zeros([1, model_settings["fingerprint_size"]])56 logits = models.create_model(fingerprint_input, model_settings, "conv",57 False)58 self.assertIsNotNone(logits)59 self.assertIsNotNone(sess.graph.get_tensor_by_name(logits.name))60 @test_util.run_deprecated_v161 def testCreateModelLowLatencyConvTraining(self):62 model_settings = self._modelSettings()63 with self.cached_session() as sess:64 fingerprint_input = tf.zeros([1, model_settings["fingerprint_size"]])65 logits, dropout_rate = models.create_model(66 fingerprint_input, model_settings, "low_latency_conv", True)67 self.assertIsNotNone(logits)68 self.assertIsNotNone(dropout_rate)69 self.assertIsNotNone(sess.graph.get_tensor_by_name(logits.name))70 self.assertIsNotNone(sess.graph.get_tensor_by_name(dropout_rate.name))71 @test_util.run_deprecated_v172 def testCreateModelFullyConnectedTraining(self):73 model_settings = self._modelSettings()74 with self.cached_session() as sess:75 fingerprint_input = tf.zeros([1, model_settings["fingerprint_size"]])76 logits, dropout_rate = models.create_model(77 fingerprint_input, model_settings, "single_fc", True)78 self.assertIsNotNone(logits)79 self.assertIsNotNone(dropout_rate)80 self.assertIsNotNone(sess.graph.get_tensor_by_name(logits.name))81 self.assertIsNotNone(sess.graph.get_tensor_by_name(dropout_rate.name))82 def testCreateModelBadArchitecture(self):83 model_settings = self._modelSettings()84 with self.cached_session():85 fingerprint_input = tf.zeros([1, model_settings["fingerprint_size"]])86 with self.assertRaises(Exception) as e:87 models.create_model(fingerprint_input, model_settings,88 "bad_architecture", True)89 self.assertIn("not recognized", str(e.exception))90 @test_util.run_deprecated_v191 def testCreateModelTinyConvTraining(self):92 model_settings = self._modelSettings()93 with self.cached_session() as sess:94 fingerprint_input = tf.zeros([1, model_settings["fingerprint_size"]])95 logits, dropout_rate = models.create_model(96 fingerprint_input, model_settings, "tiny_conv", True)97 self.assertIsNotNone(logits)98 self.assertIsNotNone(dropout_rate)99 self.assertIsNotNone(sess.graph.get_tensor_by_name(logits.name))100 self.assertIsNotNone(sess.graph.get_tensor_by_name(dropout_rate.name))101if __name__ == "__main__":...
test_stitching.py
Source:test_stitching.py
...15 def test_simple(self):16 img = self.get_sample('stitching/a1.png')17 finder= cv.ORB.create()18 imgFea = cv.detail.computeImageFeatures2(finder,img)19 self.assertIsNotNone(imgFea)20 matcher = cv.detail_BestOf2NearestMatcher(False, 0.3)21 self.assertIsNotNone(matcher)22 matcher = cv.detail_AffineBestOf2NearestMatcher(False, False, 0.3)23 self.assertIsNotNone(matcher)24 matcher = cv.detail_BestOf2NearestRangeMatcher(2, False, 0.3)25 self.assertIsNotNone(matcher)26 estimator = cv.detail_AffineBasedEstimator()27 self.assertIsNotNone(estimator)28 estimator = cv.detail_HomographyBasedEstimator()29 self.assertIsNotNone(estimator)30 adjuster = cv.detail_BundleAdjusterReproj()31 self.assertIsNotNone(adjuster)32 adjuster = cv.detail_BundleAdjusterRay()33 self.assertIsNotNone(adjuster)34 adjuster = cv.detail_BundleAdjusterAffinePartial()35 self.assertIsNotNone(adjuster)36 adjuster = cv.detail_NoBundleAdjuster()37 self.assertIsNotNone(adjuster)38 compensator=cv.detail.ExposureCompensator_createDefault(cv.detail.ExposureCompensator_NO)39 self.assertIsNotNone(compensator)40 compensator=cv.detail.ExposureCompensator_createDefault(cv.detail.ExposureCompensator_GAIN)41 self.assertIsNotNone(compensator)42 compensator=cv.detail.ExposureCompensator_createDefault(cv.detail.ExposureCompensator_GAIN_BLOCKS)43 self.assertIsNotNone(compensator)44 seam_finder = cv.detail.SeamFinder_createDefault(cv.detail.SeamFinder_NO)45 self.assertIsNotNone(seam_finder)46 seam_finder = cv.detail.SeamFinder_createDefault(cv.detail.SeamFinder_NO)47 self.assertIsNotNone(seam_finder)48 seam_finder = cv.detail.SeamFinder_createDefault(cv.detail.SeamFinder_VORONOI_SEAM)49 self.assertIsNotNone(seam_finder)50 seam_finder = cv.detail_GraphCutSeamFinder("COST_COLOR")51 self.assertIsNotNone(seam_finder)52 seam_finder = cv.detail_GraphCutSeamFinder("COST_COLOR_GRAD")53 self.assertIsNotNone(seam_finder)54 seam_finder = cv.detail_DpSeamFinder("COLOR")55 self.assertIsNotNone(seam_finder)56 seam_finder = cv.detail_DpSeamFinder("COLOR_GRAD")57 self.assertIsNotNone(seam_finder)58 blender = cv.detail.Blender_createDefault(cv.detail.Blender_NO)59 self.assertIsNotNone(blender)60 blender = cv.detail.Blender_createDefault(cv.detail.Blender_FEATHER)61 self.assertIsNotNone(blender)62 blender = cv.detail.Blender_createDefault(cv.detail.Blender_MULTI_BAND)63 self.assertIsNotNone(blender)64 timelapser = cv.detail.Timelapser_createDefault(cv.detail.Timelapser_AS_IS);65 self.assertIsNotNone(timelapser)66 timelapser = cv.detail.Timelapser_createDefault(cv.detail.Timelapser_CROP);67 self.assertIsNotNone(timelapser)68if __name__ == '__main__':...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!