Skip to content

Commit 92c8826

Browse files
authored
Add check install script (#13)
* add check install script * requirements: remove pandas and tables * Update install_desktop.md
1 parent 2ee3581 commit 92c8826

File tree

6 files changed

+98
-29
lines changed

6 files changed

+98
-29
lines changed

check_install/check_install.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
"""
2+
DeepLabCut Toolbox (deeplabcut.org)
3+
© A. & M. Mathis Labs
4+
5+
Licensed under GNU Lesser General Public License v3.0
6+
"""
7+
8+
9+
import os
10+
import shutil
11+
from dlclive import benchmark_videos
12+
13+
14+
def main():
15+
16+
# make temporary directory in $HOME
17+
print("\nCreating temporary directory...\n")
18+
home = os.path.expanduser("~")
19+
tmp_dir = os.path.normpath(f"{home}/dlc-live-tmp")
20+
os.makedirs(tmp_dir, exist_ok=True)
21+
os.chdir(tmp_dir)
22+
23+
# download exported dog model from DeepLabCut Model Zoo
24+
print("Downloading full_dog model from the DeepLabCut Model Zoo...")
25+
model_url = "http://deeplabcut.rowland.harvard.edu/models/DLC_Dog_resnet_50_iteration-0_shuffle-0.tar.gz"
26+
os.system(f"curl {model_url} | tar xvz")
27+
28+
# download dog video clip from github
29+
print("\nDownloading dog video clip...\n")
30+
#video_url = "https://github.com/DeepLabCut/DeepLabCut-live/raw/master/check_install/dog_clip.avi"
31+
video_url = '"https://docs.google.com/uc?export=download&id=1W_5AOl1SewXR2q5QC1K5Chm71I9LAmld"'
32+
os.system(f"curl -L {video_url} -o dog_clip.avi")
33+
34+
# run benchmark videos
35+
print("\n Running inference...\n")
36+
model_dir = "DLC_Dog_resnet_50_iteration-0_shuffle-0"
37+
video_file = "dog_clip.avi"
38+
benchmark_videos(model_dir, video_file, display=True, resize=0.5, pcutoff=0.25)
39+
40+
# deleting temporary files
41+
print("\n Deleting temporary files...\n")
42+
shutil.rmtree(tmp_dir)
43+
44+
print("\nDone!\n")
45+
46+
47+
if __name__ == "__main__":
48+
main()

check_install/dog_clip.avi

1.25 MB
Binary file not shown.

docs/install_desktop.md

100644100755
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
### Install DeepLabCut-live on a desktop (Windows/Ubuntu)
22

3-
We recommend that you install DeepLabCut-live in a conda environment. First, please install Anaconda:
3+
We recommend that you install DeepLabCut-live in a conda environment (It is a standard python package though, and other distributions will also likely work). In this case, please install Anaconda:
4+
45
- [Windows](https://docs.anaconda.com/anaconda/install/windows/)
56
- [Linux](https://docs.anaconda.com/anaconda/install/linux/)
67

78
Create a conda environment with python 3.7 and tensorflow:
9+
810
```
911
conda create -n dlc-live python=3.7 tensorflow-gpu==1.13.1 # if using GPU
1012
conda create -n dlc-live python=3.7 tensorflow==1.13.1 # if not using GPU
1113
```
1214

13-
Activate the conda environment and install the DeepLabCut-live package:
15+
Activate the conda environment, install the DeepLabCut-live package, then test the installation:
16+
1417
```
1518
conda activate dlc-live
1619
pip install deeplabcut-live
20+
dlc-live-test
1721
```
1822

19-
We also recommend that you have OpenCV installed:
20-
```
21-
pip install opencv-python
22-
```
23+
If installed properly, this script will i) create a temporary folder ii) download the full_dog model from the [DeepLabCut Model Zoo](http://www.mousemotorlab.org/dlc-modelzoo), iii) download a short video clip of a dog, and iv) run inference while displaying keypoints. v) remove the temporary folder.

docs/install_jetson.md

100644100755
Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
### Install DeepLabCut-live on a NVIDIA Jetson Development Kit
22

33
First, please follow NVIDIA's specific instructions to setup your Jetson Development Kit (see [Jetson Development Kit User Guides](https://developer.nvidia.com/embedded/learn/getting-started-jetson)). Once you have installed the NVIDIA Jetpack on your Jetson Development Kit, make sure all system libraries are up-to-date. In a terminal, run:
4+
45
```
56
sudo apt-get update
67
sudo apt-get upgrade
78
```
9+
810
Lastly, please test that CUDA is installed properly by running: `nvcc --version`. The output should say the version of CUDA installed on your Jetson.
911

1012
#### Install python, virtualenv, and tensorflow
1113

1214
We highly recommend installing DeepLabCut-live in a virtual environment. Please run the following command to install system dependencies needed to run python, to create virtual environments, and to run tensorflow:
15+
1316
```
1417
sudo apt-get update
1518
sudo apt-get install libhdf5-serial-dev \
@@ -29,6 +32,7 @@ sudo apt-get install libhdf5-serial-dev \
2932
#### Create a virtual environment
3033

3134
Next, create a virtual environment called `dlc-live`, activate the `dlc-live` environment, and update it's package manger:
35+
3236
```
3337
python3 -m venv dlc-live
3438
source dlc-live/bin/activate
@@ -37,7 +41,8 @@ pip install -U pip testresources setuptools
3741

3842
#### Install DeepLabCut-live dependencies
3943

40-
First, install python dependencies to run tensorflow (from [NVIDIA instructions to install tensorflow on Jetson platforms](https://docs.nvidia.com/deeplearning/frameworks/install-tf-jetson-platform/index.html)). *This may take ~15-30 minutes.*
44+
First, install python dependencies to run tensorflow (from [NVIDIA instructions to install tensorflow on Jetson platforms](https://docs.nvidia.com/deeplearning/frameworks/install-tf-jetson-platform/index.html)). _This may take ~15-30 minutes._
45+
4146
```
4247
pip3 install numpy==1.16.1 \
4348
future==0.17.1 \
@@ -51,24 +56,25 @@ pip3 install numpy==1.16.1 \
5156
pybind11
5257
```
5358

54-
Next, install tensorflow 1.x. This command will depend on the version of Jetpack you are using. If you are uncertain, please refer to [NVIDIA's instructions](https://docs.nvidia.com/deeplearning/frameworks/install-tf-jetson-platform/index.html#install). To install tensorflow 1.x on the latest version of NVIDIA Jetpack (version 4.4 as of 8/2/2020), please the command below. *This step will also take 15-30 mins*.
59+
Next, install tensorflow 1.x. This command will depend on the version of Jetpack you are using. If you are uncertain, please refer to [NVIDIA's instructions](https://docs.nvidia.com/deeplearning/frameworks/install-tf-jetson-platform/index.html#install). To install tensorflow 1.x on the latest version of NVIDIA Jetpack (version 4.4 as of 8/2/2020), please the command below. _This step will also take 15-30 mins_.
60+
5561
```
5662
pip3 install --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v44 ‘tensorflow<2’
5763
```
5864

5965
Lastly, copy the opencv-python bindings into your virtual environment:
66+
6067
```
6168
cp -r /usr/lib/python3.6/dist-packages ~/dlc-live/lib/python3.6/dist-packages
6269
```
6370

6471
#### Install the DeepLabCut-live package
6572

66-
Finally, please install DeepLabCut-live from PyPi (*this will take 3-5 mins):
73+
Finally, please install DeepLabCut-live from PyPi (_this will take 3-5 mins_), then test the installation:
74+
6775
```
6876
pip install deeplabcut-live
77+
dlc-live-test
6978
```
7079

71-
72-
73-
74-
80+
If installed properly, this script will i) download the full_dog model from the DeepLabCut Model Zoo, ii) download a short video clip of a dog, and iii) run inference while displaying keypoints.

requirements.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,3 @@ colorcet
44
pillow
55
py-cpuinfo==5.0.0
66
tqdm
7-
tables
8-
pandas

setup.py

100644100755
Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,30 @@
1616
with open("README.md", "r") as fh:
1717
long_description = fh.read()
1818

19-
install_requires = ['numpy', 'ruamel.yaml', 'colorcet', 'pillow', 'py-cpuinfo==5.0.0', 'tqdm']
19+
install_requires = [
20+
"numpy",
21+
"ruamel.yaml",
22+
"colorcet",
23+
"pillow",
24+
"py-cpuinfo==5.0.0",
25+
"tqdm",
26+
]
2027

21-
if find_spec('cv2') is None:
22-
install_requires.append('opencv-python')
23-
if (find_spec('tensorflow') is None):
24-
warnings.warn("tensorflow is not yet installed. Installing tensorflow CPU version. if you wish to use the GPU version, please run: pip install tensorflow-gpu==1.13.1")
25-
install_requires.append('tensorflow==1.13.1')
26-
if 'tegra' in platform.platform():
27-
if (find_spec('pandas') is None):
28-
warnings.warn("Not installing pandas or pytables (these can take forever on NVIDIA Jetson boards). Please install these packages if you want to use the benchmark_videos function to save poses from a video.")
28+
if find_spec("cv2") is None:
29+
install_requires.append("opencv-python")
30+
if find_spec("tensorflow") is None:
31+
warnings.warn(
32+
"tensorflow is not yet installed. Installing tensorflow CPU version. if you wish to use the GPU version, please run: pip install tensorflow-gpu==1.13.1"
33+
)
34+
install_requires.append("tensorflow==1.13.1")
35+
if "tegra" in platform.platform():
36+
if find_spec("pandas") is None:
37+
warnings.warn(
38+
"Not installing pandas or pytables (these can take forever on NVIDIA Jetson boards). Please install these packages if you want to use the benchmark_videos function to save poses from a video."
39+
)
2940
else:
30-
install_requires.append('pandas')
31-
install_requires.append('tables')
41+
install_requires.append("pandas")
42+
install_requires.append("tables")
3243

3344
setuptools.setup(
3445
name="deeplabcut-live",
@@ -39,7 +50,7 @@
3950
long_description=long_description,
4051
long_description_content_type="text/markdown",
4152
url="https://github.com/DeepLabCut/DeepLabCut-live",
42-
python_requires = '>=3.5, <3.8',
53+
python_requires=">=3.5, <3.8",
4354
install_requires=install_requires,
4455
packages=setuptools.find_packages(),
4556
include_package_data=True,
@@ -48,6 +59,11 @@
4859
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
4960
"Operating System :: OS Independent",
5061
),
51-
entry_points = {'console_scripts' : ['dlc-live-bench=dlclive.bench:main',
52-
'dlc-live-benchmark=dlclive.benchmark:main']}
62+
entry_points={
63+
"console_scripts": [
64+
"dlc-live-test=check_install.check_install:main",
65+
"dlc-live-bench=dlclive.bench:main",
66+
"dlc-live-benchmark=dlclive.benchmark:main",
67+
]
68+
},
5369
)

0 commit comments

Comments
 (0)