make_input: Create an input file to run 'classify' or 'train' in 'MLWIC'

Description Usage Arguments Details

View source: R/make_input.R

Description

make_input will make a csv with the specifications necessary to either classify images or to train a new model. See 'details' below for using the different options

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
make_input(
  input_file = NULL,
  output_dir = getwd(),
  option = NULL,
  find_file_names = FALSE,
  path_prefix = getwd(),
  image_file_suffixes = c(".jpg", ".JPG"),
  recursive = TRUE,
  usingBuiltIn = TRUE,
  model_type = "species_model",
  images_classified = FALSE,
  find_class_IDs = FALSE,
  trainTest = FALSE,
  file_prefix = "",
  shiny = FALSE,
  propTrain = 0.9
)

Arguments

input_file

The absolute path to your input csv. It must contain a column called "filename" and unless you are using the built in model, a column called "class" (which would be your species or group of species).

output_dir

The absolute path where you would like to store your new csv. It can be anywhere on your computer, but you'll want to be able to find it in the next step, so you might want to store it in your MLWIC2_helper_files folder.

option

A value of 1-5 descrbing how you want to supply data and how you want the function to create an input file. See 'details' below for what each option means. Setting an option value overrides inputs for 'find_file_names', 'usingBuiltIn', 'images_classified', 'find_class_IDs', and 'trainTest'.

find_file_names

logical. If TRUE, this function will find all image files within a specified directory. You must specify the directory ('path_prefix') for this to work. If you already have a spreadsheet (eg. a '.csv') with the names of files and their classifications, this is not the option for you.

path_prefix

Path to where your images are stored. You need to specify this if you want MLWIC2 to 'find_file_names' (or if you are using option 4).

image_file_suffixes

The suffix for your image files. Only specify this if you are using the 'find_file_names' option. The default is .jpg files. This is case-sensitive.

recursive

logical. Only necessary if you are using the 'find_file_names' option. If TRUE, the function will find all relevant image files in all subdirectories from the path you specify. If FALSE, it will only find images in the folder that you provide as your 'path_prefix'.

usingBuiltIn

logical. If TRUE, you are setting up a data file to classify images using the built in model.

model_type

If usingBuiltIn=TRUE, you can specify 'species_model' or 'empty_animal' so that your class_ID's will match those of the model

images_classified

logical. If TRUE, you have classifications to go along with these images (and you want to test how the model performs on these images).

find_class_IDs

logical. If TRUE, and you have images_classified, MLWIC2 will try to match up your text classifications with the values from the trained model. If FALSE and you have images classified, you need to have a column in your input file called 'class_ID'.

trainTest

logical. Do you want to create separate csvs for training and testing

file_prefix

What you want to appear as the filename before the suffix. If you are only creating a file to test the model, you could specify "test_" and your output file name would be "test_image_labels.csv". If you specify 'trainTest = TRUE', your suffixes will automatically be "_train.csv" and "_test.csv"

propTrain

proportion of images you want for training. '1-propTrain' is the proportion that will be used for testing the model.

Details


mikeyEcology/MLWIC2 documentation built on Feb. 18, 2021, 11:46 a.m.