Error In readLines(rf)

Hi, I am downloading the R packages tensorflow and keras for the first time. I am using these packages to analyze .jpg image files. Such as - How to build your own image recognition app with R! [Part 1] | R-bloggers

After installing these packages in addition to the reticulate and anaconda/miconda when I use the commands install_tensorflow(extra_packages=“pillow”), and then install_keras() after both installs, there is a Warning Message :
In readLines(rf) :
incomplete final line found on ‘C:\Users\aiucxk8\AppData\Local\Temp\RtmpsvR3Wl\file11bc4ee61bfb’

In ‘C:\Users\aiucxk8\AppData\Local\Temp\RtmpsvR3W’ folder, there is are 4 .rds files, an application file, and a folder containing the tensorflow 2.8.0 package.

In R, when I write -
setwd(“C:/Users/aiucxk8/Documents/imageDB/”)
label_list ← dir(“TRAINING/”)
output_n ← length(label_list)
save(label_list, file=“label_list.R”)

output_n
[1] 5853

When I ignore the above warning, I get an error.
path_train ← “/TRAINING/”
train_data_gen ← image_data_generator(rescale = 1/255, validation_split = .2)
2022-03-08 13:41:22.199666: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library ‘cudart64_110.dll’; dlerror: cudart64_110.dll not found
2022-03-08 13:41:22.200082: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Loaded Tensorflow version 2.8.0

If I ignore this error, I am not able to generate the data and train on images -

width ← 50
height<- 50
target_size ← c(width, height)

train_data_gen
<keras.preprocessing.image.ImageDataGenerator>
train_images ← flow_images_from_directory(path_train,

  • train_data_gen,
  • subset = ‘training’,
  • target_size = target_size,
  • class_mode = “categorical”,
  • shuffle=F,
  • classes = label_list,
  • seed = 2022)
    Found 0 images belonging to 5853 classes.

Please help me resolve this issue - Could not load dynamic library ‘cudart64_110.dll’; dlerror: cudart64_110.dll not found
2022-03-08 13:41:22.200082: I tensorflow/stream_executor/cuda/cudart_stub.cc:29]

Thank you!

Could not load dynamic library ‘cudart64_110.dll’; dlerror: cudart64_110.dll not found

I think this is unrelated and you need to care about this only if you want to use the GPU.

path to the target directory. It should contain one subdirectory per class. Any PNG, JPG, BMP, PPM, or TIF images inside each of the subdirectories directory tree will be included in the generator. See this script for more details

Have you double checked that your directories are organized correctly?

Hi. Thank you for your help!!! I was able to fix the (non)-issue. The problem was the path to my directory. I set the working directory with a backslash at the end, as well as started my path to the training directory with a backslash, resulting in two continuous backslashes. As such, I am able to complete my workflow using tensorflow. Thanks again!!

1 Like