Hi,
please see replies below with #
Best regards,
Jürgen
Dear Juergen,
I am writing you because I am quite confused on readtable function in CameratrapR and after having carefully read the instructions (attached pdf), consulted https://rdrr.io/cran/camtrapR/man/recordTable.htmland read google forum, plus run several tests I am still confused. I hope you could provide some help on this:
Generate a species record table from camera trap images and videos Description. Generates a record table from camera trap images or videos. Images/videos must be sorted into station directories at least.I tagged camera trap images using Digikam and stored them in folders as indicated. I just have 1 camera/station, thus 1 folder/camera. When tagging in Digikam, I (using "human knowledge") decided what is a new animal and what is not. I created a tag with "number of individuals" and assigned value=1 for any new animal and tagged value=as 0 (zero) for the other photos where the same animal appears again. That is because I want to keep the photos correctly tagged (species field) for future use in artificial intelligence trainning. I plan to analyze the camera trap data filtering the final dataset only for "number of individuals"=1 (and discard the lines where =0), but this is for studying animal paths use, thus, I prefer to keep the csv as "virgin" as possible.
So, I want to use recordtable to generate a csv with ALL the data from my photos (some will have "number of individuals"=0 and some= 1, or 2..10 if many individuals are present in that picture). That is, I want a csv where I expect one line per photo, (as many lines as photos). I do NOT want the program to remove whatever it considers a duplicate or to artificially decide what is a duplicate. I am confused with the values I should input in the different arguments in recordTable to accomplish my goal .According to camtrapR.pdf:
-removeDuplicateRecordslogical. If there are several records of the same species at the same station (alsosame camera if cameraID is defined) at exactly the same time, show only one?
I understand that, if I had 2 photos of deer Aug12, 2020 13:00:01 in C1and write=TRUE I should get 1 line for the 2 photos, because saying TRUE means I am asking R to do remove duplicates
and write= FALSE I should get 2 lines for the 2 photos because saying FALSE means I am asking R NOT to do remove duplicates
But to my surprise, in the instructions of the pdf I see: "removeDuplicateRecords determines whether duplicate records (identical station, species, date/time,(and camera if applicable)) are are all returned (TRUE) or collapsed into a single unique record (FALSE). which is exactly the opposite (a typo in the instructions or am I misunderstanding?)
To clarify, I did a test using a total of 37 pictures from 2 cameras with both options, and the results are even more confusing, as I don t know how to interpret the column "nimages" that appears in the generated csv.
when I run the code using removeDuplicateRecords =TRUE I get a table with 26 lines, nimages column in the csv = always 1
when I run the code using removeDuplicateRecords =FALSE I get a table with 37 lines, nimages column in the csv = sometimes 1, sometimes 2, 3
So, it seems to me that the pdf instructions are incorrect, arent they?
And I would like to know:
-confirmation if I should write (true or false) to get 1 line/ photo
-how to interpret the column "nimages" that appears in the generated csv. where does this value come from?
So I d like to know which code version is correct/the best complete and enough to get my csv as I want it?:
metadata <- recordTable(inDir = images,IDfrom = "directory",removeDuplicateRecords = FALSE)head(metadata)
write.csv(metadata, file = "camtrapCOMPLET.csv" )
I also tried other alternatives such as:
metadata <- recordTable(inDir = images,IDfrom = "directory",minDeltaTime = 0,deltaTimeComparedTo = "lastRecord",removeDuplicateRecords = FALSE)head(metadata)
write.csv(metadata, file = "camtrapCOMPLET.csv" )
But I am not sure what I am doing with the other possible (mandatory?) function arguments as I have these doubts:
-camerasIndependentlogical. If TRUE, species records are considered to be independent between camerasat a station.
is it this one somehow affecting how the csv is created or is this for further analysis (occupancy models) etc? can I not include it in my code at all or if it is mandatory: what value should I write?
-minDeltaTime integer. Time difference between records of the same species at the same stationto be considered independent (in minutes)I am confused about the use of "independent" here. That is, does this affect how photo metadata is exported (thus, the csv I get) or is this for further analysis? should I write =0 to get all my records?
isn t this the same as minDeltaTime integer? or maybe deltaTimeComparedTo covers the same idea but for any species (and minDeltaTime integer just for individuals of the very same species)? again should I write =0 or FALSE to get all my records? or should I write = "lastRecord" which is what I found online but don t understand? why did you include an "?" at the end of your explanation in the pdf line referring to this?
-deltaTimeComparedTocharacter. For two records to be considered independent, must the second onebe at least minDeltaTime minutes after the last independent record of the samespecies ("lastIndependentRecord"), or minDeltaTime minutes after the lastrecord ("lastRecord")?
# deltaTimeComparedTo is only relevant if minDeltaTime is
not 0. It is only relevant in the same species at the same
stations (= locations).
See this
thread for an explanation of the different options with a
few examples.
I would highly appreciate your response,
Best regards
--
You received this message because you are subscribed to the Google Groups "camtrapR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camtrapr+u...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/camtrapr/46ff7f57-1d7e-4222-9542-3358ac2344cfn%40googlegroups.com.
Code 1: removeDuplicateRecords = FALSE
metadata <- recordTable(inDir = tag_images,
IDfrom = "metadata",
metadataSpeciesTag = "2Species",
minDeltaTime = "0",
stationCol="Station",
removeDuplicateRecords = FALSE)
I get 37
lines, one per image= I am getting ALL records; nimages seem to be
counting the number of images that exist for a time:h: second.
Code 2: removeDuplicateRecords = TRUE
metadata <- recordTable(inDir = tag_images,
IDfrom = "metadata",
metadataSpeciesTag = "2Species",
minDeltaTime = "0",
stationCol="Station",
removeDuplicateRecords = TRUE)
Hi Margarita,
if you want all records, use code 1 (removeDuplicateRecords =
FALSE). The n_images column in that case is wrong, that is a bug.
I'll fix it when I have the time.
As you noted, Code 2 removes duplicates and thus returns fewer
images. This is intended. It is because two images of the same
species in the same location in the same second usually do not
provide any additional information. In your case it is different
because of the custom n_individuals tags.
The n_images column is (currently) not designed to take duplicate images into account. It is for cases where minDeltaTime is greater than 0 (for example, 60 minutes). Then this column gives an indication how many non-independent images a given record represents. It is not intended for any analyses, but only to give the user an idea of how many records are lumped when setting minDeltaTime.
On that note, the function has two arguments for summarizing
events by occasions (eventSummaryColumn, eventSummaryFunction).
They is also intended for cases where minDeltaTime > 0.
Summarizing is done after removing duplicates and thus would not
help you. I may consider changing this, but would have to rethink
a few things.
Best regards,
Jürgen
To view this discussion on the web, visit https://groups.google.com/d/msgid/camtrapr/6efcdb99-b3ab-4593-9860-702947f2b714n%40googlegroups.com.