C3D-tensorflow icon indicating copy to clipboard operation
C3D-tensorflow copied to clipboard

Issue with convert_images_to_list.sh

Open PBRAOS opened this issue 6 years ago • 5 comments

The files seems to split randomly the dataset, a 25-75 split normally should have representatives from each category. This is not the case. If for instance a category exists in one list it can be absent from another. Could be a jot versioning issue ?

PBRAOS avatar Jan 17 '19 09:01 PBRAOS

This should work better.

#!/bin/bash

train.list test.list COUNT=-1 for folder in $1/* do echo $folder COUNT=$[$COUNT + 1] for imagesFolder in "$folder"/* do

    if ( (( ( RANDOM % $2 )  ))  > 1 ); then
        echo "$imagesFolder" $COUNT >> train.list
    else
        echo "$imagesFolder" $COUNT >> test.list
    fi        
done

done

PBRAOS avatar Jan 17 '19 10:01 PBRAOS

@PBRAOS Thx .This is work for me !

highway007 avatar Mar 07 '19 08:03 highway007

Do you run it on Linux or Windows? How can I run it? I run it on Linux. There are some errors. I need your help. bash convert_images_to_list.sh /home/yan/yan1/tu 4 convert_images_to_list.sh: 行 2: $'\r': 未找到命令 convert_images_to_list.sh: 行 22: $'\r': 未找到命令 convert_images_to_list.sh: 行 27: 未预期的符号 `$'do\r'' 附近有语法错误

Yan-echo avatar Mar 31 '19 08:03 Yan-echo

Pm me

Pb

On 31 Mar 2019, at 10:29, Yan-echo [email protected] wrote:

Do you run it on Linux or Windows? How can I run it? I run it on Linux. There are some errors. I need your help. bash convert_images_to_list.sh /home/yan/yan1/tu 4 convert_images_to_list.sh: 行 2: $'\r': 未找到命令 convert_images_to_list.sh: 行 22: $'\r': 未找到命令 convert_images_to_list.sh: 行 27: 未预期的符号 `$'do\r'' 附近有语法错误

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

PBRAOS avatar Mar 31 '19 09:03 PBRAOS

This should work better. #!/bin/bash

train.list test.list COUNT=-1 for folder in $1/* do echo $folder COUNT=$[$COUNT + 1] for imagesFolder in "$folder"/* do

if ( (( ( RANDOM % $2 )  ))  > 1 ); then
    echo "$imagesFolder" $COUNT >> train.list
else
    echo "$imagesFolder" $COUNT >> test.list
fi        

done

done

This code can work, but it can't generate class, how should I do it?

Yan-echo avatar Apr 01 '19 01:04 Yan-echo