bnosac / image Goto Github PK
View Code? Open in Web Editor NEWComputer Vision and Image Recognition algorithms for R users
Computer Vision and Image Recognition algorithms for R users
I don't find any material about object detection using *h5 cnn adjusted model.
I try to create a simple example because I don't find in any book/web, I've like to apply any object detection technique to find handwritten digits in an image with several digits (wh_img). First, a create a CNN using the classic MNIST example:
library(keras)
mnist <- dataset_mnist()
x_train <- mnist$train$x
y_train <- mnist$train$y
x_test <- mnist$test$x
y_test <- mnist$test$y
#reshape
x_train <- array_reshape(x_train, c(nrow(x_train), 784))
x_test <- array_reshape(x_test, c(nrow(x_test), 784))
#rescale
x_train <- x_train / 255
x_test <- x_test / 255
y_train <- to_categorical(y_train, 10)
y_test <- to_categorical(y_test, 10)
model <- keras_model_sequential()
model %>%
layer_dense(units = 256, activation = 'relu', input_shape = c(784)) %>%
layer_dropout(rate = 0.4) %>%
layer_dense(units = 128, activation = 'relu') %>%
layer_dropout(rate = 0.3) %>%
layer_dense(units = 10, activation = 'softmax')
model %>% compile(
loss = 'categorical_crossentropy',
optimizer = optimizer_rmsprop(),
metrics = c('accuracy')
)
#Training and Evaluation
history <- model %>% fit(
x_train, y_train,
epochs = 30, batch_size = 128,
validation_split = 0.2
)
plot(history)
model %>% save_model_hdf5("cnn_digits.h5")
Now, I've to apply any object detection technique in my y.png image with several handwritten digits to find only 4 numerals using my trained model :
y = "http://mariakravtsova.us/img/numbers.png"
download.file(y,'y.png', mode = 'wb')
library("png")
wh_img <- readPNG("y.png")
plot.new()
rasterImage(wh_img,0,0,1,1)
library(image.darknet)
yolo_digits <- image_darknet_model(type = ‘detect’, labels ="4", model = "cnn_digits.h5")
x <- image_darknet_detect(file = "/Documents/numbers.png",
object = yolo_digits,
threshold = 0.4)
This is possible in R? Because in Python there are a lot of functions, choose the window size, etc. but in R not :(
Hello,
Is it possible to get the "file" for image_darknet_detect from any memory object like array/mtx etc...
This can be a cool idea for processing images from webcam/cam stream without dumping them to a file and reading them back from the file.
Thanks for your effort...
All images I have tried image_surf on return a surf vector of 64 dimension, but only the first dimension has a non-zero value. The function runs without warning or errors, and I have successfully used the exact same images to run the image_fhog function in the same package
This is true as well for the example code you give in the "computer vision for R users" presentation:
f <- system.file("extdata", "cruise_boat.bmp", package="image.dlib")
surf_blobs <- image_surf(f, max_points = 10000, detection_threshold = 50)
e.g., on the above example, from skimr
skim(as.data.frame(surf_blobs$surf))
Variable type: numeric
variable missing complete n mean sd p0 p25 median p75 p100 hist
V1 0 296 296 0.018 0.055 -0.089 0 0 0 0.32 ▁▇▁▁▁▁▁▁
V10 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V11 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V12 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V13 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V14 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V15 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V16 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V17 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V18 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V19 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V2 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V20 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V21 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V22 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V23 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V24 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V25 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V26 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V27 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V28 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V29 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V3 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V30 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V31 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V32 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V33 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V34 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V35 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V36 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V37 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V38 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V39 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V4 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V40 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V41 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V42 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V43 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V44 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V45 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V46 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V47 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V48 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V49 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V5 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V50 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V51 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V52 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V53 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V54 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V55 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V56 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V57 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V58 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V59 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V6 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V60 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V61 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V62 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V63 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V64 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V7 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V8 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
V9 0 296 296 0 0 0 0 0 0 0 ▁▁▁▇▁▁▁▁
Putting here compilation issues at CRAN machines
Package | Notes |
---|---|
image.CornerDetectionF9 | OK |
image.CornerDetectionHarris | OK + install openmp on travis mac os + font issue with image_draw |
image.LineSegmentDetector | OK |
image.ContourDetector | OK |
image.CannyEdges | OK + install libpng/fftw3 on CI for windows |
image.Otsu | OK |
image.dlib | TODO + font issue with image_draw |
image.darknet | TODO |
image.OpenPano | Linux only |
image.DenoiseNLMeans | OK - note on patent - maybe also handle greyscale images instead of only rgb |
I'm encountering a compilation error when attempting to install the image.darknet package using the devtools::install_github function in R. The error message I'm seeing is:
php
Copy code
deconvolutional_layer.c:85:14: error: incompatible function pointer types assigning to 'void (*)(struct layer, int, float, float, float)' from 'void (deconvolutional_layer, float, float, float)' (aka 'void (struct layer, float, float, float)') [-Wincompatible-function-pointer-types]
l.update = update_deconvolutional_layer;
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [deconvolutional_layer.o] Error 1
ERROR: compilation failed for package ‘image.darknet’
Steps to Reproduce:
Run the following code in R:
R
Copy code
devtools::install_github("bnosac/image", subdir = "image.darknet", build_vignettes = TRUE)
Expected Behavior:
I expect the image.darknet package to be installed without encountering any compilation errors.
Actual Behavior:
The compilation process fails with the error message mentioned above.
System Information:
R Version: 024.04.0+735
Operating System: [Your operating system]
Compiler: [If applicable]
Additional Information:
I have tried updating R and the devtools package, but the issue persists.
I have also attempted to set compiler flags (CFLAGS and CPPFLAGS) to "std=gnu99", but it did not resolve the problem.
Hi,
Trying to install image.ContourDetector on windows through rstudio, I get this error.
Did I miss something ?
Thanks.
RcppExports.cpp:24:58: error: 'image' was not declared in this scope
{"image.ContourDetector_detect_contours", (DL_FUNC) &image.ContourDetector_detect_contours, 4},
^
RcppExports.cpp:28:29: error: expected initializer before '.' token
RcppExport void R_init_image.ContourDetector(DllInfo *dll) {
^
make: *** [RcppExports.o] Error 1
Warning: l'exécution de la commande 'make -f "C:/PROGRA1/R/R-331.2/etc/x64/Makeconf" -f "C:/PROGRA1/R/R-331.2/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="image.ContourDetector.dll" WIN=64 TCLBIN=64 OBJECTS="RcppExports.o contour_detector.o image.ContourDetector_init.o smooth_contours.o"' renvoie un statut 2
ERROR: compilation failed for package 'image.ContourDetector'
Hi,
When running the image_darknet_detect function my R sessions crashes .
Do you have a solution for this problem?
Many thanks!
Using image.draknet pkg on R, with original trained Yolo weights, the "labels" class list length in the function image_darknet_model
must be larger than 1?
but I trained only 1 class. how can i do??
Similarly to #7 and #19, when I set union = T
in image_line_segment_detector()
, R crashes. The following reproduces the error for me:
library(image.LineSegmentDetector)
library(pixmap)
image <- read.pnm(file = system.file("extdata", "le-piree.pgm", package="image.LineSegmentDetector"), cellres = 1)
linesegments <- image_line_segment_detector(image@grey * 255, union = T)
R version 4.0.5 (2021-03-31)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] pixmap_0.4-12 image.LineSegmentDetector_0.1.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.7 pillar_1.6.3 compiler_4.0.5 class_7.3-19 tools_4.0.5
[6] digest_0.6.28 jsonlite_1.7.2 evaluate_0.14 lifecycle_1.0.1 tibble_3.1.5
[11] lattice_0.20-44 pkgconfig_2.0.3 rlang_0.4.11 DBI_1.1.1 yaml_2.2.1
[16] xfun_0.26 fastmap_1.1.0 e1071_1.7-9 dplyr_1.0.7 httr_1.4.2
[21] knitr_1.36 raster_3.4-13 generics_0.1.0 vctrs_0.3.8 classInt_0.4-3
[26] grid_4.0.5 tidyselect_1.1.1 glue_1.4.2 sf_1.0-2 R6_2.5.1
[31] fansi_0.5.0 rmarkdown_2.10 bookdown_0.23 sp_1.4-5 purrr_0.3.4
[36] clipr_0.7.1 magrittr_2.0.1 units_0.7-2 codetools_0.2-18 ellipsis_0.3.2
[41] htmltools_0.5.2 assertthat_0.2.1 KernSmooth_2.23-20 utf8_1.2.2 proxy_0.4-26
[46] crayon_1.4.1
I have been trying to use the image.darknet library as part of a looping process to process multiple files. It appears that doing so causes a crash of the R session. It happens using a fresh download of the library on multiple computers. On each computer, the crash consistantly happens, but happens at a different number of images. For example, on one computer the R session crashes on processing the fourth file. On another, it is always after the 18th file. This happens if the detect is called as part of a loop, a foreach package loop, or just a run-on of detect calls in the script. Here is a reproducible example that works on any computer I seem to run it on.
`
devtools::install_github("bnosac/image", subdir = "image.darknet", build_vignettes = TRUE)
library(image.darknet)
labels<-system.file(package="image.darknet", "include", "darknet", "data", "voc.names")
labels<-readLines(labels)
yolo_tiny_voc<-image_darknet_model(
type="detect",
model="tiny-yolo-voc.cfg",
weights=system.file(package="image.darknet", "models", "tiny-yolo-voc.weights"),
labels=labels)
f <- system.file("include", "darknet", "data", "dog.jpg", package="image.darknet")
for (i in 1:50){
print(i)
image_darknet_detect(file=f, object=yolo_tiny_voc, threshold=0.03)
}
`
[Additional issues](https://cran.r-project.org/web/checks/check_issue_kinds.html)
[clang19](https://www.stats.ox.ac.uk/pub/bdr/clang19/image.dlib.log) [clang19](https://www.stats.ox.ac.uk/pub/bdr/clang19/image.dlib.out) [M1mac](https://www.stats.ox.ac.uk/pub/bdr/M1mac/image.dlib.out)
Check Details
Version: 0.1.1
Check: whether package can be installed
Result: WARN
Found the following significant warnings:
../inst/dlib-19.20/dlib/image_transforms/../statistics/../optimization/optimization_solve_qp_using_smo.h:630:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_transforms/../statistics/../optimization/optimization_solve_qp_using_smo.h:910:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_transforms/../statistics/../optimization/optimization_solve_qp_using_smo.h:911:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_transforms/../statistics/../optimization/optimization_solve_qp_using_smo.h:913:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_transforms/../statistics/../optimization/optimization_solve_qp_using_smo.h:914:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_transforms/../statistics/lda.h:154:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_transforms/../statistics/lda.h:155:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_transforms/image_pyramid.h:1167:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_transforms/image_pyramid.h:1168:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_transforms/image_pyramid.h:1204:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_transforms/image_pyramid.h:1223:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_transforms/interpolation.h:2123:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_transforms/interpolation.h:2124:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_keypoint/../statistics/../optimization/optimization_solve_qp_using_smo.h:630:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_keypoint/../statistics/../optimization/optimization_solve_qp_using_smo.h:910:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_keypoint/../statistics/../optimization/optimization_solve_qp_using_smo.h:911:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_keypoint/../statistics/../optimization/optimization_solve_qp_using_smo.h:913:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_keypoint/../statistics/../optimization/optimization_solve_qp_using_smo.h:914:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_keypoint/../statistics/lda.h:154:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_keypoint/../statistics/lda.h:155:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
See ‘/home/hornik/tmp/R.check/r-devel-clang/Work/PKGS/image.dlib.Rcheck/00install.out’ for details.
* used C++ compiler: ‘Debian clang version 18.1.8 (11)’
Flavor: [r-devel-linux-x86_64-debian-clang](https://www.r-project.org/nosvn/R.check/r-devel-linux-x86_64-debian-clang/image.dlib-00check.html)
Version: 0.1.1
Check: Rd files
Result: NOTE
checkRd: (-1) image_fhog.Rd:26: Lost braces in \itemize; \value handles \item{}{} directly
checkRd: (-1) image_fhog.Rd:27: Lost braces in \itemize; \value handles \item{}{} directly
checkRd: (-1) image_fhog.Rd:28: Lost braces in \itemize; \value handles \item{}{} directly
checkRd: (-1) image_fhog.Rd:29: Lost braces in \itemize; \value handles \item{}{} directly
checkRd: (-1) image_fhog.Rd:30: Lost braces in \itemize; \value handles \item{}{} directly
checkRd: (-1) image_fhog.Rd:31: Lost braces in \itemize; \value handles \item{}{} directly
checkRd: (-1) image_surf.Rd:19: Lost braces in \itemize; \value handles \item{}{} directly
checkRd: (-1) image_surf.Rd:20: Lost braces in \itemize; \value handles \item{}{} directly
checkRd: (-1) image_surf.Rd:21: Lost braces in \itemize; \value handles \item{}{} directly
checkRd: (-1) image_surf.Rd:22: Lost braces in \itemize; \value handles \item{}{} directly
checkRd: (-1) image_surf.Rd:23: Lost braces in \itemize; \value handles \item{}{} directly
checkRd: (-1) image_surf.Rd:24: Lost braces in \itemize; \value handles \item{}{} directly
checkRd: (-1) image_surf.Rd:25: Lost braces in \itemize; \value handles \item{}{} directly
checkRd: (-1) image_surf.Rd:26: Lost braces in \itemize; \value handles \item{}{} directly
Flavors: [r-devel-linux-x86_64-debian-clang](https://www.r-project.org/nosvn/R.check/r-devel-linux-x86_64-debian-clang/image.dlib-00check.html), [r-devel-linux-x86_64-debian-gcc](https://www.r-project.org/nosvn/R.check/r-devel-linux-x86_64-debian-gcc/image.dlib-00check.html), [r-devel-linux-x86_64-fedora-clang](https://www.r-project.org/nosvn/R.check/r-devel-linux-x86_64-fedora-clang/image.dlib-00check.html), [r-devel-linux-x86_64-fedora-gcc](https://www.r-project.org/nosvn/R.check/r-devel-linux-x86_64-fedora-gcc/image.dlib-00check.html), [r-devel-windows-x86_64](https://www.r-project.org/nosvn/R.check/r-devel-windows-x86_64/image.dlib-00check.html), [r-patched-linux-x86_64](https://www.r-project.org/nosvn/R.check/r-patched-linux-x86_64/image.dlib-00check.html), [r-release-linux-x86_64](https://www.r-project.org/nosvn/R.check/r-release-linux-x86_64/image.dlib-00check.html), [r-release-macos-arm64](https://www.r-project.org/nosvn/R.check/r-release-macos-arm64/image.dlib-00check.html), [r-release-macos-x86_64](https://www.r-project.org/nosvn/R.check/r-release-macos-x86_64/image.dlib-00check.html), [r-release-windows-x86_64](https://www.r-project.org/nosvn/R.check/r-release-windows-x86_64/image.dlib-00check.html)
Version: 0.1.1
Check: whether package can be installed
Result: WARN
Found the following significant warnings:
../inst/dlib-19.20/dlib/image_transforms/../statistics/../optimization/optimization_solve_qp_using_smo.h:630:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_transforms/../statistics/../optimization/optimization_solve_qp_using_smo.h:910:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_transforms/../statistics/../optimization/optimization_solve_qp_using_smo.h:911:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_transforms/../statistics/../optimization/optimization_solve_qp_using_smo.h:913:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_transforms/../statistics/../optimization/optimization_solve_qp_using_smo.h:914:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_transforms/../statistics/lda.h:154:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_transforms/../statistics/lda.h:155:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_transforms/image_pyramid.h:1167:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_transforms/image_pyramid.h:1168:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_transforms/image_pyramid.h:1204:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_transforms/image_pyramid.h:1223:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_transforms/interpolation.h:2123:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_transforms/interpolation.h:2124:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_keypoint/../statistics/../optimization/optimization_solve_qp_using_smo.h:630:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_keypoint/../statistics/../optimization/optimization_solve_qp_using_smo.h:910:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_keypoint/../statistics/../optimization/optimization_solve_qp_using_smo.h:911:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_keypoint/../statistics/../optimization/optimization_solve_qp_using_smo.h:913:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_keypoint/../statistics/../optimization/optimization_solve_qp_using_smo.h:914:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_keypoint/../statistics/lda.h:154:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
../inst/dlib-19.20/dlib/image_keypoint/../statistics/lda.h:155:9: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
See ‘/data/gannet/ripley/R/packages/tests-clang/image.dlib.Rcheck/00install.out’ for details.
* used C++ compiler: ‘clang version 18.1.8’
Flavor: [r-devel-linux-x86_64-fedora-clang](https://www.r-project.org/nosvn/R.check/r-devel-linux-x86_64-fedora-clang/image.dlib-00check.html)
Version: 0.1.1
Check: installed package size
Result: NOTE
installed size is 10.9Mb
sub-directories of 1Mb or more:
dlib-19.20 9.5Mb
Flavors: [r-devel-linux-x86_64-fedora-clang](https://www.r-project.org/nosvn/R.check/r-devel-linux-x86_64-fedora-clang/image.dlib-00check.html), [r-devel-windows-x86_64](https://www.r-project.org/nosvn/R.check/r-devel-windows-x86_64/image.dlib-00check.html), [r-release-macos-arm64](https://www.r-project.org/nosvn/R.check/r-release-macos-arm64/image.dlib-00check.html), [r-release-macos-x86_64](https://www.r-project.org/nosvn/R.check/r-release-macos-x86_64/image.dlib-00check.html), [r-release-windows-x86_64](https://www.r-project.org/nosvn/R.check/r-release-windows-x86_64/image.dlib-00check.html), [r-ol](https://www.r-project.org/nosvn/R.check/r-oldrel-macos-arm64/image.dlib-00check.html)
Hi!
I tried to make detection with this two models: yolo_tiny_voc and yolo_tiny_coco. The first model detect the object but the second one don't detect anything. The code I used is it:
yolo_tiny_voc <- image_darknet_model(type = 'detect',
model = "tiny-yolo-voc.cfg",
weights = system.file(package="image.darknet", "models", "tiny-yolo-voc.weights"),
labels = system.file(package="image.darknet", "include", "darknet", "data", "voc.names"))
yolo_tiny_voc
x <- image_darknet_detect("__path__", object = yolo_tiny_voc)
###################################
yolo_tiny_coco <- image_darknet_model(type = 'detect',
model = "tiny-yolo-voc.cfg",
weights = system.file(package="image.darknet", "models", "tiny-yolo.weights"),
labels = system.file(package="image.darknet", "include", "darknet", "data", "coco.names"))
##
x <- image_darknet_detect("__path__", object = yolo_tiny_coco)
I would find a model with 80 labels that works in a detection model. I found only a model with 20 labels that works for detection.
Thank you
image_line_segment_detector(img, union = T)
returns a pixel matrix the size of the image with all 0 values. Ideally, this would also update when union = T so that joined lines are represented by the same number.
library(imager)
library(image.LineSegmentDetector)
im <- load.image(system.file('extdata/parrots.png', package='imager'))
im_pnm <- im %>%
grayscale() %>%
multiply_by(255)
im_pnm <- im_pnm[ , , 1, 1]
nounion <- image_line_segment_detector(im_pnm)
withunion <- image_line_segment_detector(im_pnm, union = T)
sum(nounion$pixels != 0) # 19414
sum(withunion$pixels != 0) # 0
Hi,
first of all: thanks for the implementation of such a tool!
I'm following the code in your example:
im <- image_read(file.path(out.folder,"raster","fence_0.25m.tif"))
im = image_data(im)
mat <- as.integer(im, transpose = TRUE)
mat <- drop(mat)
cld = image_contour_detector(mat)
plot(cld)
I'm using it to extract guard rails from an aerial image. It works pretty fine and super quickly even though all spatial references (coordinates) are lost in the process of conversion to matrix (but I think that can be solved with a workaround).
Right now I'm looking for a method to extract the lines from the cld
object as a vector (sp
or sf
) object but I can't find any info in the data
slot such as e.g. beginning of line, end of line, other. In addition, the x/y
coords provided in the data
slot do not correspond to cell positions (i.e. x = row number+1, y = to a decimal number; see example below).
x y curve
1 2 645.5518 1
2 3 645.0601 1
3 4 644.8012 1
Anything I'm missing? how are coords encoded?
Thanks in advance
For example, in this picture of people in Lima, Peru, it doesn't detect a face: https://www.maxpixel.net/static/photo/1x/South-America-Lima-Peru-Road-Colorful-Color-1244329.jpg
Another example, this time from Wikimedia, it detects 3 faces: https://upload.wikimedia.org/wikipedia/commons/e/ec/Urarina_shaman_B_Dean.jpg
Using a smaller resolution from the second image, it doesn't detect any face (source: https://upload.wikimedia.org/wikipedia/commons/thumb/e/ec/Urarina_shaman_B_Dean.jpg/406px-Urarina_shaman_B_Dean.jpg)
I've used exactly the same code as the article in http://www.bnosac.be/index.php/blog/89-human-face-detection-with-r
library(magick)
library(image.libfacedetection)
# using an image where it fails to detect a face
img_url <- "https://upload.wikimedia.org/wikipedia/commons/thumb/e/ec/Urarina_shaman_B_Dean.jpg/406px-Urarina_shaman_B_Dean.jpg"
image <- image_read(img_url)
faces <- image_detect_faces(image)
faces
plot(faces, image, border = "red", lwd = 7, col = "white")
I am showing below the results from printing the faces
object:
> faces
$nr
[1] 0
$detections
[1] x y width height neighbours
[6] angle
<0 rows> (or 0-length row.names)
attr(,"class")
[1] "libfacedetection"
Is it a problem with the image resolution perhaps? If so, then it should be noted in the documentation, and perhaps change the comment in https://github.com/bnosac/image/blob/master/image.libfacedetection/man/image_detect_faces.Rd which in line 20 indicates:
The function can be used to detect faces of minimal size 48x48 pixels.
Reproducibility information
> R.version
_
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 3
minor 5.2
year 2018
month 12
day 20
svn rev 75870
language R
version.string R version 3.5.2 (2018-12-20)
nickname Eggshell Igloo
> packageVersion("magick")
[1] ‘2.0’
> packageVersion("image.libfacedetection")
[1] ‘0.1’
Hi,
I get an error trying to install darknet.
devtools::install_github("bnosac/image", subdir = "image.darknet", build_vignettes = TRUE)
```detector.o:detector.c:(.text+0x17cb):undefined reference to
pthread_join'
detector.o:detector.c:(.text+0x1844): undefined reference to `pthread_join'
detector.o:detector.c:(.text+0x18c1): more undefined references to `pthread_join' follow
collect2: ld returned 1 exit status
keine DLL erzeugt
ERROR: compilation failed for package 'image.darknet'
R version 3.2.4 Revised (2016-03-16 r70336)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252 LC_MONETARY=German_Germany.1252
[4] LC_NUMERIC=C LC_TIME=German_Germany.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] dlib_1.0
loaded via a namespace (and not attached):
[1] httr_1.2.1 R6_2.2.0 tools_3.2.4 withr_1.0.2 curl_2.5 memoise_1.1.0 Rcpp_0.12.10
[8] git2r_0.18.0 digest_0.6.12 devtools_1.12.0```
https://github.com/gfacciol/mgm
https://github.com/mnhrdt/imscript
https://github.com/kidanger/degradations-deconvolution
https://github.com/ShiqiYu/libfacedetection
https://cran.r-project.org/web/packages/CovTools/index.html
https://cran.r-project.org/web/packages/filling/filling.pdf
https://www.maths.nottingham.ac.uk/plp/pmzild/shapes/
I've like to use the image_darknet_model()
with my custom YOLOv3 model. For this, first I put my obj_100.weights
file that represents the weights of my custom model create using darknet53.conv.74
inside the library directory image.darknet/models
. After, I make the same with my obj.cfg
in image.darknet/include/darknet/cfg
directory and obj.names
in image.darknet/include/darknet/data
directory. Then, I try to use the image_darknet_model()
function:
library(image.darknet)
yolo_v3_my_weights <- image_darknet_model(type = 'classify',
model = "obj.cfg", weights = system.file(package="image.darknet", "models", "obj_100.weights"),
labels = system.file(package="image.darknet", "include", "darknet", "data", "obj.names"))
Error in image_darknet_model(type = "classify", model = "obj.cfg", weights = system.file(package = "image.darknet", :
file.exists(model) is not TRUE
But the I have the model in correct directory:
setwd("~/R/win-library/3.6/image.darknet/models")
dir()
[1] "obj_100.weights" "tiny-yolo-voc.weights" "tiny.weights"
The file is OK and I don't have any problem with obj_100.weights
file in the darknet in Python.
Please, any solution for this?
After having installed image.darknet in R I tried to carry out the model using the weights trained on "coco", just copying the code and nothing else. That said, I gave input a very simple "object" to detect (it was a sweetie cat), but the output has been the following:
C:////*/cat.jpg: Predicted in 5.22000 seconds.
Boxes: 845 of which 0 above the threshold.
After that I have tried with some other images whose content were bottles, dogs, so I guess the model shouldn't have any problem to detect them correctly since the coco model provides the possibility to detect those labels.
I suppose that I am missing something critical. Any help?
Thanks in advance for your answers!
Hi there,
I am trying to print the output of the function image_darknet_detect, but I'm unable to figure it out. More specifically: I'm trying to print the bounding boxes and the labels of the boxes (e.g. persons: 22%, car: 89%). Can anybody tell me how to do that?
I tried to get this information out of the object, but it didn't work.
Help is appreciated.
Hi!
I tired this code:
yolo_tiny_voc <- image_darknet_model(type = 'detect', model = "tiny-yolo-voc.cfg", weights=system.file(package="image.darknet", "models", "tiny-yolo-voc.weights"), labels = system.file(package="image.darknet", "include", "darknet", "data", "voc.names"))
x<-image_darknet_detect(paste(getwd(), "/tempPicture.jpg", sep=""), object = yolo_tiny_voc)
The output of this code is :
layer filters size input output
0 conv 16 3 x 3 / 1 416 x 416 x 3 -> 416 x 416 x 16
1 max 2 x 2 / 2 416 x 416 x 16 -> 208 x 208 x 16
2 conv 32 3 x 3 / 1 208 x 208 x 16 -> 208 x 208 x 32
3 max 2 x 2 / 2 208 x 208 x 32 -> 104 x 104 x 32
4 conv 64 3 x 3 / 1 104 x 104 x 32 -> 104 x 104 x 64
5 max 2 x 2 / 2 104 x 104 x 64 -> 52 x 52 x 64
6 conv 128 3 x 3 / 1 52 x 52 x 64 -> 52 x 52 x 128
7 max 2 x 2 / 2 52 x 52 x 128 -> 26 x 26 x 128
8 conv 256 3 x 3 / 1 26 x 26 x 128 -> 26 x 26 x 256
9 max 2 x 2 / 2 26 x 26 x 256 -> 13 x 13 x 256
10 conv 512 3 x 3 / 1 13 x 13 x 256 -> 13 x 13 x 512
11 max 2 x 2 / 1 13 x 13 x 512 -> 13 x 13 x 512
12 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024
13 conv 1024 3 x 3 / 1 13 x 13 x1024 -> 13 x 13 x1024
14 conv 125 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 125
15 detection
Loading weights from ---------------------/R/x86_64-pc-linux-gnu-library/3.3/image.darknet/models/tiny-yolo-voc.weights...Done!
--------------------------/tempPicture.jpg: Predicted in 2.397771 seconds.
Boxes: 845 of which 1 above the threshold.
person: 93%
So the model detect one person into the image.
I wish save into x that te model detect one person. But the value of x is NULL
I tried also the function capture.output() to capture the fact that the model find a person in the image but the result of
capture.output(image_darknet_detect(paste(getwd(), "/tempPicture.jpg", sep=""), object=yolo_tiny_voc))
is charather(0).
Could you help me? It seem impossible extract the result of the detection.
Ty
P.S. I would detect 1000 image and put the result of the detection in a model like randomForset in order to predict a value for this reason I wish put the result of the detection in a data.frame
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.