Visitar URL original
Pull demo data from Zenodo by jeylau · Pull Request #2440 · DeepLabCut/DeepLabCut · GitHub
Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Pull demo data from Zenodo
  • Loading branch information
jeylau committed Nov 9, 2023
commit e6dac47695b84db68c4b47577bc7158634953b9f
32 changes: 17 additions & 15 deletions examples/COLAB/COLAB_transformer_reID.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,21 @@
"outputs": [],
"source": [
"# Download our demo project:\n",
"import urllib.request\n",
"import requests\n",
"from io import BytesIO\n",
"from zipfile import ZipFile\n",
"\n",
"def unzip_from_url(url, dest_folder=''):\n",
" # Directly extract files without writing the archive to disk\n",
" resp = urllib.request.urlopen(url)\n",
" with ZipFile(BytesIO(resp.read())) as zf:\n",
" zf.extractall(path=dest_folder)\n",
"\n",
"\n",
"project_url = \"http://deeplabcut.rowland.harvard.edu/datasets/demo-me-2021-07-14.zip\"\n",
"unzip_from_url(project_url, \"/content\")"
"url_record = 'https://zenodo.org/api/records/7883589'\n",
"response = requests.get(url_record)\n",
"if response.status_code == 200:\n",
" file = response.json()['files'][0]\n",
" title = file['key']\n",
" print(f\"Downloading {title}...\")\n",
" with requests.get(file['links']['self'], stream=True) as r:\n",
" with ZipFile(BytesIO(r.content)) as zf:\n",
" zf.extractall(path='/content')\n",
"else:\n",
" raise ValueError(f'The URL {url_record} could not be reached.')"
]
},
{
Expand Down Expand Up @@ -138,10 +140,10 @@
"outputs": [],
"source": [
"#Filter the predictions to remove small jitter, if desired:\n",
"dlc.filterpredictions(config_path, \n",
" [video], \n",
"dlc.filterpredictions(config_path,\n",
" [video],\n",
" shuffle=0,\n",
" videotype='mp4', \n",
" videotype='mp4',\n",
" )\n",
"\n",
"dlc.create_labeled_video(\n",
Expand Down Expand Up @@ -230,8 +232,8 @@
},
"outputs": [],
"source": [
"dlc.plot_trajectories(config_path, [video], \n",
" shuffle=0,videotype='mp4', \n",
"dlc.plot_trajectories(config_path, [video],\n",
" shuffle=0,videotype='mp4',\n",
" track_method=\"transformer\"\n",
" )"
]
Expand Down