{"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":"# 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\n\nimport imageio as iio\nimport tensorflow as tf\nimport scipy as sp  # linear algebra\n\n# import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\nfrom keras.applications.densenet import layers\n\noutputFile = \"submission.csv\"\ncsv_file = open(outputFile, \"w\")\ncsv_file.close()\n\nimport os\n\n\ndef match(im):\n    # score1 x1 y1 w1 h1 +...\n    # csv_file.write(\"a,1\\nb,2\\nc,3\")\n    pass\n\n\nfilenames = dir('./train_images/*/*')\nds = tf.data.TFRecordDataset(\n    filenames, compression_type=None, buffer_size=None, num_parallel_reads=None,\n    name=None\n)\n# Define Sequential model with 3 layers\nmodel = tf.keras.Sequential(\n    [\n        layers.Dense(2, activation=\"relu\", name=\"layer1\"),\n        layers.Dense(3, activation=\"relu\", name=\"layer2\"),\n        layers.Dense(4, name=\"layer3\"),\n    ]\n)\n# Call model on a test input\nx = tf.ones((3, 3))\ny = model(ds)\n\nfor dirname, _, filenames in os.walk('./train_images/'):\n    for dirname1 in filenames:\n        print(dirname + \"/\" + dirname1)\n        pathname = os.path.join(dirname, dirname1)\n        if pathname[:-4] == \".jpg\":\n            print(\"dir('\" + dirname + \"', '\" + pathname + \"'}\\n\")\n            im = iio.imread(pathname)\n            entries = match(im)\n            # score1 x1 y1 w1 h1 +...\n            # csv_file.write(\"a,1\\nb,2\\nc,3\")\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create\n# a version using \"Save & Run All\" You can also write temporary files to /kaggle/temp/, but they won't be saved\n# outside of the current session\n","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2021-12-17T13:48:26.050111Z","iopub.execute_input":"2021-12-17T13:48:26.050406Z","iopub.status.idle":"2021-12-17T13:48:41.166301Z","shell.execute_reply.started":"2021-12-17T13:48:26.050375Z","shell.execute_reply":"2021-12-17T13:48:41.165584Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"> I’m new to OpenCV and I search for a starting point for training CascadeHaar model for object detection. I have true positive (images with the object), negative (background images without the object) and I’ve just download OpenCV for work either on Windows and command line or Python.","metadata":{}},{"cell_type":"code","source":"\n","metadata":{"execution":{"iopub.status.busy":"2021-12-17T13:10:53.422357Z","iopub.execute_input":"2021-12-17T13:10:53.422853Z","iopub.status.idle":"2021-12-17T13:10:53.616162Z","shell.execute_reply.started":"2021-12-17T13:10:53.422819Z","shell.execute_reply":"2021-12-17T13:10:53.614771Z"},"trusted":true},"execution_count":null,"outputs":[]}]}