# NOT RUN {
endp <- customvision_training_endpoint(url="endpoint_url", key="key")
# classification
proj1 <- create_classification_project(endp, "myproject")
list_images(proj1)
imgs <- dir("path/to/images", full.names=TRUE)
# recycling: apply one tag to all images
add_images(proj1, imgs, tags="mytag")
list_images(proj1, include="tagged", as="dataframe")
# different tags per image
add_images(proj1, c("cat.jpg", "dog.jpg", tags=c("cat", "dog"))
# adding online images
host <- "https://mysite.example.com/"
img_urls <- paste0(host, c("img1.jpg", "img2.jpg", "img3.jpg"))
add_images(proj1, img_urls, tags="mytag")
# multiple label classification
proj2 <- create_classification_project(endp, "mymultilabelproject", multiple_tags=TRUE)
add_images(proj2, imgs, tags=list(c("tag1", "tag2")))
add_images(proj2, c("catanddog.jpg", "cat.jpg", "dog.jpg"),
tags=list(
c("cat", "dog"),
"cat",
"dog"
)
)
# object detection
proj3 <- create_object_detection_project(endp, "myobjdetproj")
regions <- list(
data.frame(
tag=c("cat", "dog"),
left=c(0.1, 0.5),
top=c(0.25, 0.28),
width=c(0.24, 0.21),
height=c(0.7, 0.6)
),
data.frame(
tag="cat", left=0.5, top=0.35, width=0.25, height=0.62
),
data.frame(
tag="dog", left=0.07, top=0.12, width=0.79, height=0.5
)
)
add_images(proj3, c("catanddog.jpg", "cat.jpg", "dog.jpg"), regions=regions)
# }
Run the code above in your browser using DataLab