How to use execution_path method in autotest

Best Python code snippet using autotest_python

configs.py

Source:configs.py Github

copy

Full Screen

1import os2from pathlib import Path3from typing import List, Optional4class ModelConfig(object):5 def __init__(self,6 execution_path: Optional[Path] = None,7 session_type: Optional[str] = None,8 model_paths: Optional[List[str]] = None,9 input_dims: Optional[List] = None,10 input_names: Optional[List[str]] = None,11 ) -> None:12 super(ModelConfig, self).__init__()13 self.execution_path = execution_path14 self.session_type = session_type15 self.model_paths = model_paths16 self.input_dims = input_dims17 self.input_names = input_names18class LayoutDetectionConfig(ModelConfig):19 """20 Configuration for Layout Detection model.21 """22 def __init__(self,23 execution_path=None,24 session_type="layout_detection",25 model_paths=["models/layout_detection.onnx"],26 input_dims=[[(1, 1, 256, 532)]],27 input_names=['input'],28 img_shape=(532, 256), 29 mean_color=232.39989563566854,30 std_color=18.40033969873782431 ) -> None:32 self.execution_path = execution_path33 self.session_type = session_type34 self.model_paths = model_paths35 self.input_dims = input_dims36 self.input_names = input_names37 self.img_shape = img_shape38 self.mean_color = mean_color39 self.std_color = std_color40 if self.execution_path is not None:41 for i in range(len(model_paths)):42 self.model_paths[i] = str(os.path.join(self.execution_path, 43 Path(self.model_paths[i])))44class ColumnSegmentationConfig(ModelConfig):45 """46 Configuration for Column Segmentation model.47 """48 def __init__(self,49 execution_path=None,50 session_type='column_segmentation',51 model_paths=["models/column_segmentation.onnx"],52 input_dims=[[(1, 1, 512, 512), (1, 7), (1, 7)]],53 input_names=["input", "y_def_top", "y_def_bot"],54 max_y=900,55 border_size=(900, 900),56 model_size=(512, 512),57 fil_color=231.16418034341754,58 mean_color=231.16418034341754,59 std_color=28.86447999069045560 ):61 62 self.execution_path = execution_path63 self.session_type = session_type64 self.model_paths = model_paths65 self.input_dims = input_dims66 self.input_names = input_names67 self.max_y = max_y68 self.border_size = border_size69 self.model_size = model_size70 self.fil_color = fil_color71 self.mean_color = mean_color72 self.std_color = std_color73 if self.execution_path is not None:74 for i in range(len(model_paths)):75 self.model_paths[i] = str(os.path.join(self.execution_path, 76 Path(self.model_paths[i])))77class SignalRetrievalConfig(ModelConfig):78 """79 Configuration for Signal Retrieval model.80 """81 def __init__(self,82 execution_path=None,83 session_type='signal_retrieval',84 model_paths=["models/signal_retrieval_bs_2.onnx", "models/signal_retrieval_bs_5.onnx", "models/signal_retrieval_bs_11.onnx"],85 input_dims=[[(2, 1, 168, 300)], [(5, 1, 168, 300)], [(11, 1, 168, 300)]],86 input_names=['input'],87 img_shape=(168, 300),88 mean_color=228.9562434174826,89 std_color=44.05940553015075,90 window_size=300,91 max_height=168,92 supported_track_lengths=[450, 900, 1800]93 ) -> None:94 95 self.execution_path = execution_path96 self.session_type = session_type97 self.model_paths = model_paths98 self.input_dims = input_dims99 self.input_names = input_names100 self.img_shape = img_shape101 self.mean_color = mean_color102 self.std_color = std_color103 self.window_size = window_size104 self.max_height = max_height105 self.supported_track_lengths = supported_track_lengths106 if self.execution_path is not None:107 for i in range(len(model_paths)):108 self.model_paths[i] = str(os.path.join(self.execution_path, 109 Path(self.model_paths[i])))110class SignalReconstructionConfig(ModelConfig):111 """112 Configuration for Signal Reconstruction model.113 """114 def __init__(self,115 execution_path=None,116 session_type='signal_reconstruction',117 model_paths=["models/signal_reconstruction_length_1250.onnx", "models/signal_reconstruction_length_2500.onnx", "models/signal_reconstruction_length_5000.onnx"],118 input_dims=[[(1, 1250, 168), (1, 1, 1), (1, 1250)], [(1, 2500, 168), (1, 1, 1), (1, 2500)], [(1, 5000, 168), (1, 1, 1), (1, 5000)]],119 input_names=["input_seq", "input_scaling_factor", "input_mask"],120 max_lengths=[1250, 2500, 5000],121 ) -> None:122 123 self.execution_path = execution_path124 self.session_type = session_type125 self.model_paths = model_paths126 self.input_dims = input_dims127 self.input_names = input_names128 self.max_lengths = max_lengths129 if self.execution_path is not None:130 for i in range(len(model_paths)):131 self.model_paths[i] = str(os.path.join(self.execution_path, ...

Full Screen

Full Screen

fireNet.py

Source:fireNet.py Github

copy

Full Screen

1from imageai.Detection.Custom import CustomObjectDetection, CustomVideoObjectDetection2import os3execution_path = os.getcwd()4def train_detection_model():5 from imageai.Detection.Custom import DetectionModelTrainer6 trainer = DetectionModelTrainer()7 trainer.setModelTypeAsYOLOv3()8 trainer.setDataDirectory(data_directory="fire-dataset")9 trainer.setTrainConfig(object_names_array=["fire"], batch_size=8, num_experiments=100,10 train_from_pretrained_model="pretrained-yolov3.h5")11 # download 'pretrained-yolov3.h5' from the link below12 # https://github.com/OlafenwaMoses/ImageAI/releases/download/essential-v4/pretrained-yolov3.h513 trainer.trainModel()14def detect_from_image():15 detector = CustomObjectDetection()16 detector.setModelTypeAsYOLOv3()17 detector.setModelPath(detection_model_path=os.path.join(execution_path, "detection_model-ex-33--loss-4.97.h5"))18 detector.setJsonPath(configuration_json=os.path.join(execution_path, "detection_config.json"))19 detector.loadModel()20 detections = detector.detectObjectsFromImage(input_image=os.path.join(execution_path, "1.jpg"),21 output_image_path=os.path.join(execution_path, "1-detected.jpg"),22 minimum_percentage_probability=40)23 for detection in detections:24 print(detection["name"], " : ", detection["percentage_probability"], " : ", detection["box_points"])25def detect_from_video():26 detector = CustomVideoObjectDetection()27 detector.setModelTypeAsYOLOv3()28 detector.setModelPath(detection_model_path=os.path.join(execution_path, "detection_model-ex-33--loss-4.97.h5"))29 detector.setJsonPath(configuration_json=os.path.join(execution_path, "detection_config.json"))30 detector.loadModel()...

Full Screen

Full Screen

main.py

Source:main.py Github

copy

Full Screen

1"""2This module implements the ReallySmartBrain exercise of the Section 21 of the course.3"""4import os5from imageai.Prediction import ImagePrediction6def calculate_prediction():7 # Get te execution path8 execution_path = os.getcwd()9 # Create the image prediction object and load the model10 # See https://github.com/OlafenwaMoses/ImageAI/blob/master/imageai/Prediction/CUSTOMPREDICTION.md#customprediction11 prediction = ImagePrediction()12 prediction.setModelTypeAsSqueezeNet()13 prediction.setModelPath(os.path.join(execution_path, "models/squeezenet_weights_tf_dim_ordering_tf_kernels.h5"))14 prediction.loadModel()15 # Calculate the prediction16 predictions, probabilities = prediction.predictImage(os.path.join(execution_path, "images/giraffe.jpg"),17 result_count=5)18 # Print the results19 for eachPrediction, eachProbability in zip(predictions, probabilities):20 print(eachPrediction, " : ", eachProbability)21# Entry point of the script22if __name__ == '__main__':23 # Call the calculate prediction function...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful