{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"from fastai.vision.all import *","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"path = Path(\"../input/hpa-single-cell-image-classification\")","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df = pd.read_csv(path/'train.csv')\ndf.head()","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!mkdir 512_RGB","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def get_x(row):\n    ID = row[\"ID\"]\n    r = np.array(Image.open(path/'train'/(ID + \"_red.png\")))\n    g = np.array(Image.open(path/'train'/(ID + \"_green.png\")))\n    b = np.array(Image.open(path/'train'/(ID + \"_blue.png\")))\n    rgb = Image.fromarray(np.dstack([r, g, b])).resize((512, 512)).save('512_RGB/' + ID + \".png\")","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# df.iloc[:10,:].apply(get_x, axis=1)\ndf.apply(get_x, axis = 1)","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!zip -r HPA_512_RGB.zip ./512_RGB","metadata":{"trusted":true},"execution_count":null,"outputs":[]}]}