Код: Выделить всё
setup.py,image_classification.pyВ моем примере я пытаюсь :
Код: Выделить всё
library(shiny)
library(shinydashboard)
library(rsconnect)
library(tidyverse)
library(reticulate)
library(purrr)
library(stringr)
# Read setup.py with Yolov8 in Python
#setup.py file content: ---------------------
# # install yolov8
# from ultralytics import YOLO
#-------------------------------------------
# Create conda env if not exist
if(!("yolodetec_py1" %in% conda_list()$name)){
# conda_create("yolodetec_py1", python_version = "3.7")
use_condaenv("yolodetec_py1", required = TRUE)
# Set up python libraries for object detection
source_python("setup.py")
}
# Open the training YOLOv8 *pt image_classification.py
# image_classification.py file content: ----
#
# Import my trained model
# model = YOLO (r"https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt")
# Load detection model
# detection_model = model()
#-------------------------------------------
# Load model and prediction functions
source_python("image_classification.py")
# Load the model
model
Подробнее здесь: [url]https://stackoverflow.com/questions/78473894/yolov8-cnn-model-in-shiny-mixing-r-and-python[/url]