import yolov5 # Absolute path to the custom-trained weight file weight_file_path = '/path/to/your/custom_weights.pt' # Load the YOLOv5 model with the custom-trained weights model = yolov5.load(weight_file_path) # Now you can use the model for inference or further processing