{"cells":[{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load in \n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the \"../input/\" directory.\n# For example, running this (by clicking run or pressing Shift+Enter) will list the files in the input directory\n\nimport os\nprint(os.listdir(\"../\"))\n\n# Any results you write to the current directory are saved as output.","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"## generate 5 times test dataframe"},{"metadata":{"trusted":true},"cell_type":"code","source":"for i in range(5):\n    test_df_add = pd.read_csv(\"../input/sample_submission.csv\")\n    test_df_add[\"id\"] = test_df_add[\"id\"] + \"_\" + str(i)\n    if i == 0:\n        test_df = test_df_add\n    else:\n        test_df = pd.concat([test_df, test_df_add]).reset_index(drop=True)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"df_dir = \"../test/\"\nif not os.path.isdir(df_dir):\n    os.mkdir(df_dir)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"test_df.to_csv(df_dir + \"sample_submission.csv\")","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"os.listdir(df_dir)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"## generate 5 times test dataset"},{"metadata":{"trusted":true},"cell_type":"code","source":"import shutil\ntest_root = \"../input/test/\"\ntest_list = os.listdir(test_root)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"print(\"before generate: %d\" % len(os.listdir(test_root)))","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"img_dir = \"../test/img/\"\nif not os.path.isdir(img_dir):\n    os.mkdir(img_dir)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"for i in range(5):\n    for j in range(len(test_list)):\n        shutil.copy(test_root + test_list[j], img_dir + test_list[j].replace(\".png\",\"\") + \"_\" + str(i) + \".png\")","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"print(\"after generate: %d\" % len(os.listdir(img_dir)))","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"len(os.listdir(img_dir))/len(os.listdir(test_root))","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"## label copy"},{"metadata":{"trusted":true},"cell_type":"code","source":"shutil.copy(\"../input/labels.csv\", df_dir + \"labels.csv\")","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"## result"},{"metadata":{"trusted":true},"cell_type":"code","source":"print(os.listdir(\"../test/\"))","execution_count":null,"outputs":[]}],"metadata":{"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"name":"python","version":"3.6.4","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat":4,"nbformat_minor":1}