To test the Caffe, prepare a bunch of picture preparation tests. Before the operation was prepared for renaming, it is now necessary to read the file name all out to generate txt as a label to use. This procedure uses the Find command and the SED command.
Look first.
Of course, there is a follow-up process, that is, after all the file names tagged serial number, this is the role of the SED command, here I also made the sh file, convenient to use, the code as follows, self-reference modification use it.
$path$train_file#‘s/pattern/your_word/g‘ file_path/filename‘s/$/ 6/g‘$train_file
1. Find command:
Find is followed by an address that holds the file you want to find, followed by the-name parameter, followed by a parameter representing the file name *.jpg that represents all the JPG files.
The ' > ' symbol represents output to a file, which is output to a TXT file.
2. SED command:
-I means directly modifying the contents of the read file, not the output to the terminal
The content in the quotation marks represents the substitution, the $ represents at the end of the file, followed by a space and a number representing each line of characters followed by a space and a number, representing the file corresponding to the label ordinal
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Get the file name in Ubuntu and generate the list txt