CSAFE-ISU / handwriter

Forensic Handwriting Analysis Pipeline in R - Please download our stable version from CRAN using 'install.packages("handwriter")'
https://csafe-isu.github.io/handwriter/
GNU Affero General Public License v3.0
24 stars 9 forks source link

Writer IDs cannot contain letters #152

Closed stephaniereinders closed 4 months ago

stephaniereinders commented 4 months ago

Describe the bug If the writer IDs in the filenames of the model training documents contain letters, fit_model() produces the error:

To Reproduce Steps to reproduce the behavior:

  1. Created a folder called "handwriter_demo" on my desktop. Created a folder called "data" inside the "handwriter_demo" folder. Created a folder called "model_docs" inside the "data" folder.
  2. Copied a cluster template "template.rds" into the "data" folder
  3. Copied the following handwriting samples from the CSAFE Handwriting database into the model_docs folder:
    [1] "w0009_s01_pWOZ_r01.png" "w0009_s01_pWOZ_r02.png" "w0009_s01_pWOZ_r03.png"
    [4] "w0030_s01_pWOZ_r01.png" "w0030_s01_pWOZ_r02.png" "w0030_s01_pWOZ_r03.png"
    [7] "w0203_s01_pWOZ_r01.png" "w0203_s01_pWOZ_r02.png" "w0203_s01_pWOZ_r03.png"
    [10] "w0238_s01_pWOZ_r01.png" "w0238_s01_pWOZ_r02.png" "w0238_s01_pWOZ_r03.png"
    [13] "w0400_s01_pWOZ_r01.png" "w0400_s01_pWOZ_r02.png" "w0400_s01_pWOZ_r03.png"
  4. Ran the following code in RStudio
    main_dir <- "~/Desktop/handwriter_demo"
    model <- fit_model(main_dir = main_dir,
                   model_docs = file.path(main_dir, "data", "model_docs"),
                   num_iters = 200,
                   num_cores = 4,
                   writer_indices = c(1,5),
                   doc_indices = c(7,18))
  5. This produces an error: Error in rjags::jags.model(textConnection(model_wrapped_cauchy), data = rjags_data, : RUNTIME ERROR: Unable to resolve the following parameters: docwriter[1] (line 31) docwriter[2] (line 31) docwriter[3] (line 31) docwriter[4] (line 31) docwriter[5] (line 31) docwriter[6] (line 31) docwriter[7] (line 31) docwriter[8] (line 31) docwriter[9] (line 31) docwriter[10] (line 31) docwriter[11] (line 31) docwriter[12] (line 31) docwriter[13] (line 31) docwriter[14] (line 31) docwriter[15] (line 31) letterwriter[1] (line 5) letterwriter[2] (line 5) letterwriter[3] (line 5) letterwriter[4] (line 5) letterwriter[5] (line 5) letterwriter[6] (line 5) letterwriter[7] (line 5) letterwriter[8] (line 5) letterwriter[9] (line 5) letterwriter[10] (line 5) letterwriter[11] (line 5) letterwriter[12] (line 5) letterwriter[13] (line 5) letterwriter[14] (line 5) letterwriter[15] (line 5) letterwriter[16] (line 5) letterwriter[17] (line 5) letterwriter[18] (line 5) letterwriter[19] (line 5) letterwriter[20] (line 5) letterwriter[21] (line 5) letterwriter[22] (line 5) letterwriter[23] (

Expected behavior handwriter should be able to create a model from files where the writer IDs contain letters