{"id":47905124,"url":"https://github.com/nripstein/video-contact-pipeline","last_synced_at":"2026-04-04T04:48:46.148Z","repository":{"id":336785859,"uuid":"1151097463","full_name":"nripstein/video-contact-pipeline","owner":"nripstein","description":"Automating 250+ hours of repetitive lab work with computer vision","archived":false,"fork":false,"pushed_at":"2026-03-14T18:06:51.000Z","size":2933,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-04T04:48:44.083Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nripstein.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-06T03:42:32.000Z","updated_at":"2026-02-13T04:38:45.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/nripstein/video-contact-pipeline","commit_stats":null,"previous_names":["nripstein/video-contact-pipeline"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/nripstein/video-contact-pipeline","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nripstein%2Fvideo-contact-pipeline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nripstein%2Fvideo-contact-pipeline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nripstein%2Fvideo-contact-pipeline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nripstein%2Fvideo-contact-pipeline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nripstein","download_url":"https://codeload.github.com/nripstein/video-contact-pipeline/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nripstein%2Fvideo-contact-pipeline/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31388168,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T04:26:24.776Z","status":"ssl_error","status_checked_at":"2026-04-04T04:23:34.147Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-04T04:48:45.459Z","updated_at":"2026-04-04T04:48:46.144Z","avatar_url":"https://github.com/nripstein.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿\n# Contact Duration Detection\nThis repository supports the thesis work in the \u003ca href=\"https://pnb.mcmaster.ca/goldreich-lab/CurrentRes.html#Modeling\"\u003eGoldreich Lab\u003c/a\u003e, focused on estimating object‑contact duration from hand video. It contains a refactored, project‑specific pipeline built on top of the original 100‑DOH model.\n\nFor project context and results, see `docs/ug-thesis.md`.\n\n## Installation\nThis was only tested on Ubuntu 22.04 with an NVIDIA GPU. CUDA and cuDNN must be installed before using this repository.\n\n\n## Prerequisites\n\nCreate a conda environment, install pytorch-1.12.1, cuda-11.3:\n* python=3.8\n* cudatoolkit=11.3\n* pytorch=1.12.1\n\n\n\n## Preparation\n\nClone the repository:\n```\ngit clone https://github.com/nripstein/Thesis-100-DOH \u0026\u0026 cd Thesis-100-DOH\n```\n\n## Environment \u0026 Compilation\n### Environment Setup:\nCopy and paste the following commands into the command line:\n```\nconda create --name handobj_new python=3.8\nconda activate handobj_new\nconda install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=11.3 -c pytorch\npip install -r requirements.txt\ncd lib\n# then install gcc 10  \nsudo apt install gcc-10 g++-10\nexport CC=/usr/bin/gcc-10\nexport CXX=/usr/bin/g++-10\n# now that we have gcc 10, can compile\nCC=/usr/bin/gcc-10 CXX=/usr/bin/g++-10 python setup.py build develop\n```\nInstall all the python dependencies using pip:\n```\npip install -r requirements.txt\n```\n\n\u003c!-- You will meet some errors about coco dataset: (not the best but the easiest solution)\n```\ncd data\ngit clone https://github.com/pdollar/coco.git \ncd coco/PythonAPI\nmake\n``` --\u003e\n\u003c!-- \nIf you meet some error about spicy, make sure you downgrade to scipy=1.1.0:\n```\npip install scipy=1.1.0\n``` --\u003e\n\n## New Pipeline (Batch Capable)\n\nSee `QUICKSTART.md` for a concise, runnable guide.\nNotebook setup and workflows are in `docs/NOTEBOOKS.md`, `notebooks/pipeline_starter.ipynb`, and `notebooks/postprocess_only.ipynb`.\nReproducible notebook bootstrap (recommended):\n```\nscripts/bootstrap_notebook.sh shan_et_al2\n```\n\n### How to run\n\nPreprocess only:\n```\npython run_pipeline.py --input /path/to/input --output-dir results/run/ --preprocess-only --no-crop --no-flip\n```\n\nInference + condense:\n```\npython run_pipeline.py --input /path/to/input --output-dir results/run/\n```\n\nCondense tie-break strategy (duplicate frame labels):\n```\n# default: legacy/thesis behavior (prefers No Contact)\npython run_pipeline.py --input /path/to/input --output-dir results/run/ --condense-priority-strategy no_contact_first\n\n# refactor behavior (prefers Portable Object)\npython run_pipeline.py --input /path/to/input --output-dir results/run/ --condense-priority-strategy portable_first\n```\n\nOptional filter flags:\n```\n# small-object filter is OFF by default; enable explicitly if desired\npython run_pipeline.py --input /path/to/input --output-dir results/run/ --small-object-filter --obj-smaller-factor 2.0\n\n# disable small-object filter explicitly (useful for parity or reproducibility)\npython run_pipeline.py --input /path/to/input --output-dir results/run/ --no-small-object-filter\n```\n\nOptional tracking bridge (off by default):\n```\n# enable short-horizon motion-only bridge to recover detector misses\npython run_pipeline.py --input /path/to/input --output-dir results/run/ --tracking-bridge\n\n# tune bridging behavior\npython run_pipeline.py --input /path/to/input --output-dir results/run/ \\\n  --tracking-bridge \\\n  --tracking-max-missed-frames 8 \\\n  --tracking-iou-threshold 0.15 \\\n  --tracking-init-obj-confidence 0.70 \\\n  --tracking-promotion-confirm-frames 2 \\\n  --tracking-reassociate-iou-threshold 0.10\n\n# optional: allow Stationary Object -\u003e Portable Object promotions on miss frames\npython run_pipeline.py --input /path/to/input --output-dir results/run/ \\\n  --tracking-bridge \\\n  --tracking-promote-stationary \\\n  --tracking-stationary-iou-threshold 0.20 \\\n  --tracking-stationary-confirm-frames 2\n```\n\nBatch mode:\n```\npython run_pipeline.py --input /path/to/folder_of_videos --output-dir results/batch_run/\n```\n\nBatch outputs are written to:\n```\nresults/batch_run/\u003cvideo_stem\u003e/\n```\n\nOptional GT barcode overlay:\n```\npython run_pipeline.py --input /path/to/input --output-dir results/run/ --gt-csv /path/to/gt.csv\n```\n\nPostprocess-only (existing CSVs):\n```\npython run_pipeline.py --barcodes-only --condensed-csv /path/to/detections_condensed.csv --output-dir results/post/\npython run_pipeline.py --annotated-frames-only --full-csv /path/to/detections_full.csv --image-dir /path/to/frames --output-dir results/post/\n```\n\nHSMM refinement with posterior probabilities + confidence barcode:\n```\npython scripts/run_hsmm_refinement.py \\\n  --condensed-csv /path/to/detections_condensed.csv \\\n  --gt-csv /path/to/gt.csv \\\n  --k-segments 11 \\\n  --alpha-during-trial 9.0 \\\n  --lambda-during-trial 0.1 \\\n  --alpha-between-trials 9.0 \\\n  --lambda-between-trials 0.075 \\\n  --fpr 0.1 \\\n  --fnr 0.1 \\\n  --return-posteriors \\\n  --no-progress\n```\n\nWith `--return-posteriors`, HSMM writes these additional artifacts under `\u003cpred_dir\u003e/hsmm_refinement/`:\n- `hsmm_posteriors.csv` with columns `\u003cframe_column\u003e, posterior_contact`\n- `barcode_confidence_refined_gt.png` (top: `P(holding)` with line overlay, middle: refined prediction barcode, bottom: GT barcode)\n\nContact timeline video (pred vs GT, optional secondary prediction track):\n```\npython scripts/make_contact_timeline_video.py \\\n  --condensed-csv /path/to/detections_condensed.csv \\\n  --image-dir /path/to/frames \\\n  --gt-csv /path/to/gt.csv\n\n# optional: add a second prediction timeline row for side-by-side comparison\npython scripts/make_contact_timeline_video.py \\\n  --condensed-csv /path/to/new_model/detections_condensed.csv \\\n  --secondary-condensed-csv /path/to/baseline/detections_condensed.csv \\\n  --image-dir /path/to/frames\n```\n\nRepeatable shrunk-dataset experiment workflow (inference -\u003e metrics -\u003e frames_det -\u003e videos):\n```\npython scripts/run_shrunk_full_workflow.py \\\n  --run-name 2026-02-08_shrunk_baseline \\\n  --profile baseline \\\n  --skip-existing \\\n  --no-progress\n```\n\nExperiment variants (custom inference flags):\n```\npython scripts/run_shrunk_full_workflow.py \\\n  --run-name 2026-02-09_tracking_sweep \\\n  --profile baseline \\\n  --pipeline-arg=--tracking-bridge \\\n  --pipeline-arg=--tracking-max-missed-frames \\\n  --pipeline-arg=12 \\\n  --recompute-all \\\n  --no-progress\n```\n\nRegression testing:\n```\npytest -q\nTEST_INPUT=\"/path/to/input\" scripts/run_parity_suite.sh\n```\n\nLegacy code lives under `archive/` (reference‑only).\n\n### Metrics (quantitative evaluation)\n\nEvaluate condensed predictions against a GT CSV:\n```\npython scripts/evaluate_metrics.py --pred /path/to/detections_condensed.csv --gt /path/to/gt.csv\n```\n\nThis reports MoF (frame-wise accuracy), Edit score, and F1@{10,25,50,75}.\n\n## Provenance\nThis repository is adapted from the [100‑DOH Repository](https://github.com/ddshan/hand_object_detector),\nthe code for *Understanding Human Hands in Contact at Internet Scale* (CVPR 2020, Oral).\nDandan Shan, Jiaqi Geng*, Michelle Shu*, David F. Fouhey.\nProject and dataset webpage: http://fouheylab.eecs.umich.edu/~dandans/projects/100DOH/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnripstein%2Fvideo-contact-pipeline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnripstein%2Fvideo-contact-pipeline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnripstein%2Fvideo-contact-pipeline/lists"}