Skip to content

Instantly share code, notes, and snippets.

@Pked01
Created September 18, 2018 10:54
Show Gist options
  • Save Pked01/9531ae0810ba524bc437ed38b17a9e10 to your computer and use it in GitHub Desktop.
Save Pked01/9531ae0810ba524bc437ed38b17a9e10 to your computer and use it in GitHub Desktop.
ABG/vision_related/helmet detection/downloads/Untitled.ipynb
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"metadata": {
"ExecuteTime": {
"start_time": "2018-09-18T10:31:24.268602Z",
"end_time": "2018-09-18T10:31:25.056585Z"
},
"trusted": true
},
"cell_type": "code",
"source": "import pandas as pd\nimport os,sys,json,pickle\nimport numpy as np",
"execution_count": 1,
"outputs": [
{
"output_type": "stream",
"text": "/home/ubuntu/.virtualenvs/cv_p3/lib/python3.5/site-packages/matplotlib/__init__.py:1066: UserWarning: Duplicate key in file \"/home/ubuntu/.config/matplotlib/matplotlibrc\", line #2\n (fname, cnt))\n/home/ubuntu/.virtualenvs/cv_p3/lib/python3.5/site-packages/matplotlib/__init__.py:1066: UserWarning: Duplicate key in file \"/home/ubuntu/.config/matplotlib/matplotlibrc\", line #3\n (fname, cnt))\n",
"name": "stderr"
}
]
},
{
"metadata": {
"ExecuteTime": {
"start_time": "2018-09-18T10:38:19.780127Z",
"end_time": "2018-09-18T10:38:19.896188Z"
},
"trusted": true
},
"cell_type": "code",
"source": "ls annotated_files/construction-engineer/20180918_104459/rect/",
"execution_count": 7,
"outputs": [
{
"output_type": "stream",
"text": "10. construction-salary.jpg.csv\r\n11. maxresdefault.jpg.csv\r\n12. 240_f_165460141_1e5prtfeht9sieswhnyvum5au6xq9fj1.jpg.csv\r\n13. 1.jpg.csv\r\n14. 1c6a9690.jpg.csv\r\n15. construction-engineering.jpg.csv\r\n16. construction-engineer-720.jpg.csv\r\n17. man-in-orange-hard-hat-and-business-suit-with-building-structure-in-the-background.jpg.csv\r\n18. msc-struct-eng-with-mat-stock.jpg.csv\r\n1. research-construction.jpg.csv\r\n20. 800px_colourbox4661519.jpg.csv\r\n21. istock_47111084_small.jpg.csv\r\n22. construction-workers-working-on-construction-site-112156580-5b7ff6dfc9e77c005096765c.jpg.csv\r\n23. constructionworker1280x700-1280x500.jpg.csv\r\n26. 121024025715-66-best-jobs-construction-project-engineer-gallery-horizontal.jpg.csv\r\n27. whoweare.jpg.csv\r\n28. 41681798-construction-engineer-in-hardhat-and-safety-jacket-checking-building-site.jpg.csv\r\n29. civil-engineering-and-architecture.jpg.csv\r\n2. istock-645370990-2.jpg.csv\r\n30. civil-engineering-672x372.jpg.csv\r\n31. construction-engineer-edited.jpg.csv\r\n32. sr-193-13.jpg.csv\r\n33. construction-engineer-holding-construction-drawing-with-foreman-worker-m15c0k.jpg.csv\r\n35. construction-engineer-looking-at-drawings-stock-photo.jpg.csv\r\n36. construction-engineering.jpg.csv\r\n37. main-qimg-5c980c33bea41db8679dd3ac719ad80e.jpg.csv\r\n39. 500_f_188651772_8qywbpsgeeddbzfpepffdqvqsygiqfvp.jpg.csv\r\n3. construction+engineer+preview.jpg.csv\r\n40. about-civil-eng-header.png.csv\r\n41. angry-upset-young-construction-engineer-yeling-at-the-phone-picture-id878789378.jpg.csv\r\n43. portrait-construction-engineer-holding-blueprint-convesation-via-phone-yellow-crane-new-building-background-42345844.jpg.csv\r\n44. 428-structural-engineer-63-1397632262.jpg.csv\r\n45. 275833-solhero.jpg.csv\r\n46. 800px_colourbox4661520.jpg.csv\r\n47. structural-engineer-job-description.jpg.csv\r\n48. kpff_pph_site_visit_005.jpg.csv\r\n4. construction-engineer-stock-picture-1684948.jpg.csv\r\n50. 6141150633_b0df3ac1fb_b.jpg.csv\r\n51. structural-design-engineer.jpg.csv\r\n55. engi01.jpeg.csv\r\n57. construction-engineers-discussion-architects-site-260nw-622211642.jpg.csv\r\n5. structural-engineer.jpg.csv\r\n",
"name": "stdout"
}
]
},
{
"metadata": {
"ExecuteTime": {
"start_time": "2018-09-18T10:53:01.770112Z",
"end_time": "2018-09-18T10:53:01.778812Z"
},
"trusted": true
},
"cell_type": "code",
"source": "\ndef get_all_file_path(source_dir,ext='.csv')\n for root, dirs, files in os.walk(\"annotated_files/construction-engineer/20180918_104459/rect/\"):\n for file in files:\n if file.endswith(\".csv\"):\n print(os.path.join(root, file))",
"execution_count": 26,
"outputs": [
{
"output_type": "stream",
"text": "annotated_files/construction-engineer/20180918_104459/rect/23. constructionworker1280x700-1280x500.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/31. construction-engineer-edited.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/21. istock_47111084_small.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/57. construction-engineers-discussion-architects-site-260nw-622211642.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/28. 41681798-construction-engineer-in-hardhat-and-safety-jacket-checking-building-site.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/47. structural-engineer-job-description.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/26. 121024025715-66-best-jobs-construction-project-engineer-gallery-horizontal.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/44. 428-structural-engineer-63-1397632262.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/50. 6141150633_b0df3ac1fb_b.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/32. sr-193-13.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/12. 240_f_165460141_1e5prtfeht9sieswhnyvum5au6xq9fj1.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/48. kpff_pph_site_visit_005.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/3. construction+engineer+preview.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/4. construction-engineer-stock-picture-1684948.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/16. construction-engineer-720.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/14. 1c6a9690.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/35. construction-engineer-looking-at-drawings-stock-photo.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/18. msc-struct-eng-with-mat-stock.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/36. construction-engineering.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/30. civil-engineering-672x372.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/10. construction-salary.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/2. istock-645370990-2.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/33. construction-engineer-holding-construction-drawing-with-foreman-worker-m15c0k.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/15. construction-engineering.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/20. 800px_colourbox4661519.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/11. maxresdefault.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/41. angry-upset-young-construction-engineer-yeling-at-the-phone-picture-id878789378.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/40. about-civil-eng-header.png.csv\nannotated_files/construction-engineer/20180918_104459/rect/27. whoweare.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/13. 1.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/51. structural-design-engineer.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/29. civil-engineering-and-architecture.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/39. 500_f_188651772_8qywbpsgeeddbzfpepffdqvqsygiqfvp.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/37. main-qimg-5c980c33bea41db8679dd3ac719ad80e.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/46. 800px_colourbox4661520.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/43. portrait-construction-engineer-holding-blueprint-convesation-via-phone-yellow-crane-new-building-background-42345844.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/22. construction-workers-working-on-construction-site-112156580-5b7ff6dfc9e77c005096765c.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/55. engi01.jpeg.csv\nannotated_files/construction-engineer/20180918_104459/rect/5. structural-engineer.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/1. research-construction.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/17. man-in-orange-hard-hat-and-business-suit-with-building-structure-in-the-background.jpg.csv\nannotated_files/construction-engineer/20180918_104459/rect/45. 275833-solhero.jpg.csv\n",
"name": "stdout"
}
]
},
{
"metadata": {
"ExecuteTime": {
"start_time": "2018-09-18T10:42:55.498698Z",
"end_time": "2018-09-18T10:42:55.501876Z"
},
"trusted": true
},
"cell_type": "code",
"source": "files = os.listdir('annotated_files/construction-engineer/20180918_104459/rect/') + os.listdir('annotated_files/construction-engineer/20180918_123855/rect')",
"execution_count": 15,
"outputs": []
},
{
"metadata": {
"ExecuteTime": {
"start_time": "2018-09-18T10:43:54.540109Z",
"end_time": "2018-09-18T10:43:54.543076Z"
},
"trusted": true
},
"cell_type": "code",
"source": "name_correct = [file_name[4:] for file_name in files]",
"execution_count": 22,
"outputs": []
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "for i in files:\n ",
"execution_count": null,
"outputs": []
},
{
"metadata": {
"ExecuteTime": {
"start_time": "2018-09-18T10:44:21.534036Z",
"end_time": "2018-09-18T10:44:21.539848Z"
},
"trusted": true
},
"cell_type": "code",
"source": "name_correct",
"execution_count": 25,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 25,
"data": {
"text/plain": "['constructionworker1280x700-1280x500.jpg.csv',\n 'construction-engineer-edited.jpg.csv',\n 'istock_47111084_small.jpg.csv',\n 'construction-engineers-discussion-architects-site-260nw-622211642.jpg.csv',\n '41681798-construction-engineer-in-hardhat-and-safety-jacket-checking-building-site.jpg.csv',\n 'structural-engineer-job-description.jpg.csv',\n '121024025715-66-best-jobs-construction-project-engineer-gallery-horizontal.jpg.csv',\n '428-structural-engineer-63-1397632262.jpg.csv',\n '6141150633_b0df3ac1fb_b.jpg.csv',\n 'sr-193-13.jpg.csv',\n '240_f_165460141_1e5prtfeht9sieswhnyvum5au6xq9fj1.jpg.csv',\n 'kpff_pph_site_visit_005.jpg.csv',\n 'onstruction+engineer+preview.jpg.csv',\n 'onstruction-engineer-stock-picture-1684948.jpg.csv',\n 'construction-engineer-720.jpg.csv',\n '1c6a9690.jpg.csv',\n 'construction-engineer-looking-at-drawings-stock-photo.jpg.csv',\n 'msc-struct-eng-with-mat-stock.jpg.csv',\n 'construction-engineering.jpg.csv',\n 'civil-engineering-672x372.jpg.csv',\n 'construction-salary.jpg.csv',\n 'stock-645370990-2.jpg.csv',\n 'construction-engineer-holding-construction-drawing-with-foreman-worker-m15c0k.jpg.csv',\n 'construction-engineering.jpg.csv',\n '800px_colourbox4661519.jpg.csv',\n 'maxresdefault.jpg.csv',\n 'angry-upset-young-construction-engineer-yeling-at-the-phone-picture-id878789378.jpg.csv',\n 'about-civil-eng-header.png.csv',\n 'whoweare.jpg.csv',\n '1.jpg.csv',\n 'structural-design-engineer.jpg.csv',\n 'civil-engineering-and-architecture.jpg.csv',\n '500_f_188651772_8qywbpsgeeddbzfpepffdqvqsygiqfvp.jpg.csv',\n 'main-qimg-5c980c33bea41db8679dd3ac719ad80e.jpg.csv',\n '800px_colourbox4661520.jpg.csv',\n 'portrait-construction-engineer-holding-blueprint-convesation-via-phone-yellow-crane-new-building-background-42345844.jpg.csv',\n 'construction-workers-working-on-construction-site-112156580-5b7ff6dfc9e77c005096765c.jpg.csv',\n 'engi01.jpeg.csv',\n 'tructural-engineer.jpg.csv',\n 'esearch-construction.jpg.csv',\n 'man-in-orange-hard-hat-and-business-suit-with-building-structure-in-the-background.jpg.csv',\n '275833-solhero.jpg.csv',\n 'lider-4-1-1.jpg.csv',\n 'joe_stewart.jpg.csv',\n 'business-people-group-on-meeting-and-presentation-with-construction-picture-id648413036.jpg.csv',\n 'meng-cem-program.jpg.csv',\n 'construction_engineer.jpg.csv',\n 'ce-explained.jpg.csv',\n '6da1e0ae-d970-4a5c-9c06-ec6b22edb270.jpg.csv',\n 'webp.net-compress-image-10.jpg.csv',\n 'civil_engineering78ga.jpg.csv',\n 'aa-1080x675.jpg.csv',\n 'onstruction.engineering.jpg.csv',\n 'structural-engineer-1.jpg.csv',\n 'building-and-construction-engineering-image-1449148778.jpg.csv',\n '1.jpg.csv',\n 'civil-engineering.jpg.csv',\n 'archetect-on-construction-site.jpg.csv',\n 'construction-management.jpg.csv',\n '96182689_jpg.csv',\n 'onstruction-engineer.jpg.csv',\n 'maxresdefault.jpg.csv',\n 'engineering_management_1.jpg.csv',\n 'banner-01.jpg.csv',\n 'bigstock--168081923_600x.jpg.csv',\n 'asian-business-man-construction-engineer-worker-at-house-building-picture-id922181438.jpg.csv',\n 'reliabilityengineering.png.csv',\n 'construction-engineering.jpg.csv',\n 'contractor_abroad_4.jpg.csv',\n 'osu_cce_bridge_team_1314_web.jpg.csv',\n 'fut-09-15-15-drones-2.jpg.csv',\n 'a-chinese-construction-engineer-works-at-a-section-of-the-mombasa-nairobi-standard-gauge-railway-e1494855329851.jpg.csv']"
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "",
"execution_count": null,
"outputs": []
}
],
"metadata": {
"kernelspec": {
"name": "cv_p3",
"display_name": "cv_p3",
"language": "python"
},
"language_info": {
"mimetype": "text/x-python",
"nbconvert_exporter": "python",
"name": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2",
"file_extension": ".py",
"codemirror_mode": {
"version": 3,
"name": "ipython"
}
},
"latex_envs": {
"eqNumInitial": 1,
"eqLabelWithNumbers": true,
"current_citInitial": 1,
"cite_by": "apalike",
"bibliofile": "biblio.bib",
"LaTeX_envs_menu_present": true,
"labels_anchors": false,
"latex_user_defs": false,
"user_envs_cfg": false,
"report_style_numbering": false,
"autoclose": false,
"autocomplete": true,
"hotkeys": {
"equation": "Ctrl-E",
"itemize": "Ctrl-I"
}
},
"gist": {
"id": "",
"data": {
"description": "ABG/vision_related/helmet detection/downloads/Untitled.ipynb",
"public": true
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment