Skip to content

Commit 88b7481

Browse files
authored
Merge pull request #23 from EntropyOrg/obj-detect
Add object detection demo
2 parents c39657e + 176b189 commit 88b7481

10 files changed

+1719
-3
lines changed

.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
notebook/
44
!notebook/InferenceUsingTFHubMobileNetV2Model.ipynb
55
!notebook/InferenceUsingTFHubEnformerGeneExprPredModel.ipynb
6+
!notebook/InferenceUsingTFHubCenterNetObjDetect.ipynb

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
README.pod -diff linguist-generated=true
22
lib/AI/TensorFlow/Libtensorflow/Manual/Notebook/InferenceUsingTFHubMobileNetV2Model.pod -diff linguist-generated=true
33
lib/AI/TensorFlow/Libtensorflow/Manual/Notebook/InferenceUsingTFHubEnformerGeneExprPredModel.pod -diff linguist-generated=true
4+
lib/AI/TensorFlow/Libtensorflow/Manual/Notebook/InferenceUsingTFHubCenterNetObjDetect.pod -diff linguist-generated=true

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,7 @@ notebook/targets_human.txt
1313
notebook/clinvar.vcf.*
1414
notebook/deepmind_enformer_1*
1515
notebook/enformer-target-interval-tracks.png
16+
17+
# notebook/InferenceUsingTFHubCenterNetObjDetect.ipynb
18+
notebook/tensorflow_centernet_hourglass_512x512_1*
19+
notebook/objects-detected.png

docker/Dockerfile.nb-obj-detect

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#syntax=docker/dockerfile-upstream:1.4.0-rc1
2+
3+
# notebook/InferenceUsingTFHubCenterNetObjDetect.ipynb
4+
5+
# Packages from Ubuntu focal base
6+
ARG NB_APT_PKGS_RUN=" libjpeg-turbo8 libpng16-16 netpbm gnuplot-nox"
7+
ARG NB_APT_PKGS_DEV="perl-doc libjpeg-turbo8-dev libpng-dev"
8+
ARG NB_POD="AI::TensorFlow::Libtensorflow::Manual::Notebook::InferenceUsingTFHubCenterNetObjDetect"
9+
10+
FROM base AS nb-builder
11+
12+
ARG NB_APT_PKGS_RUN
13+
ARG NB_APT_PKGS_DEV
14+
ARG NB_POD
15+
16+
USER root
17+
18+
RUN apt-get update && apt-get install -y --no-install-recommends $NB_APT_PKGS_RUN $NB_APT_PKGS_DEV
19+
RUN bash -c ' \
20+
eval $(perl -Mlocal::lib=/perl5-nb); \
21+
export MAKEFLAGS=$(nproc); \
22+
plx cpm install -g --cpanfile=<( \
23+
awk "/=head1 CPANFILE/,EOF {print}" $( plx perldoc -l $NB_POD ) \
24+
| awk "NR>1" \
25+
)'
26+
RUN apt-get remove -y $NB_APT_PKGS_DEV && apt-get autoremove -y && apt-get clean
27+
RUN rm -Rf $HOME/.perl-cpm/ $HOME/.cpanm
28+
29+
FROM base AS object-detection
30+
31+
ARG NB_APT_PKGS_RUN
32+
ARG NB_POD
33+
34+
ARG NB_USER
35+
ARG NB_UID
36+
37+
USER root
38+
39+
COPY --from=nb-builder /perl5-nb /perl5-nb
40+
41+
RUN apt-get update && apt-get install -y --no-install-recommends $NB_APT_PKGS_RUN
42+
43+
RUN apt-get -qq purge \
44+
&& apt-get -qq clean \
45+
&& rm -rf /var/lib/apt/lists/*
46+
47+
RUN chown -R ${NB_USER}:${NB_USER} /perl5-nb
48+
49+
USER ${NB_USER}
50+
51+
RUN bash -c 'plx perl -c $( plx perldoc -l $NB_POD );'
52+
53+
# vim:ft=dockerfile

docker/Dockerfile.nb-omnibus

+6-2
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
# Builds on top of:
66
# - docker/Dockerfile.nb-image-class
77
# - docker/Dockerfile.nb-gene-expr-pred
8+
# - docker/Dockerfile.nb-obj-detect
89
#
910
# The contents of `NB_APT_PKGS_RUN` come from those `Dockerfile`s.
1011
ARG NB_APT_PKGS_RUN=" \
1112
libjpeg-turbo8 libpng16-16 libgsl23 \
1213
samtools libhts3 tabix libxml2 libexpat1 libdb5.3 netpbm gnuplot-nox \
14+
libjpeg-turbo8 libpng16-16 netpbm gnuplot-nox \
1315
"
1416

1517
FROM base as omnibus
@@ -23,6 +25,7 @@ USER root
2325

2426
COPY --from=nb-image-class /perl5-nb /perl5-nb-image-class
2527
COPY --from=nb-gene-expr-pred /perl5-nb /perl5-nb-gene-expr-pred
28+
COPY --from=nb-obj-detect /perl5-nb /perl5-nb-obj-detect
2629

2730
RUN apt-get update && apt-get install -y --no-install-recommends $NB_APT_PKGS_RUN
2831

@@ -32,8 +35,8 @@ RUN apt-get -qq purge \
3235

3336
RUN \
3437
mkdir -p /perl5-nb \
35-
&& cp -pR /perl5-nb-image-class/. /perl5-nb-gene-expr-pred/. /perl5-nb/ \
36-
&& rm -Rf /perl5-nb-image-class /perl5-nb-gene-expr-pred
38+
&& cp -pR /perl5-nb-image-class/. /perl5-nb-gene-expr-pred/. /perl5-nb-obj-detect/. /perl5-nb/ \
39+
&& rm -Rf /perl5-nb-image-class /perl5-nb-gene-expr-pred /perl5-nb-obj-detect
3740

3841
RUN chown -R ${NB_USER}:${NB_USER} /perl5-nb
3942

@@ -45,6 +48,7 @@ RUN bash -c ' \
4548
for NB_POD in \
4649
AI::TensorFlow::Libtensorflow::Manual::Notebook::InferenceUsingTFHubMobileNetV2Model \
4750
AI::TensorFlow::Libtensorflow::Manual::Notebook::InferenceUsingTFHubEnformerGeneExprPredModel \
51+
AI::TensorFlow::Libtensorflow::Manual::Notebook::InferenceUsingTFHubCenterNetObjDetect \
4852
; do \
4953
plx perl -c $( plx perl -MPod::Simple::Search -e "print Pod::Simple::Search->new->find(shift @ARGV)" $NB_POD ); \
5054
done;'

docker/docker-bake.hcl

+13
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ group "default" {
55
"nb-omnibus",
66
"nb-image-class",
77
"nb-gene-expr-pred",
8+
"nb-obj-detect",
89
]
910
}
1011

@@ -106,13 +107,24 @@ target "nb-gene-expr-pred" {
106107
tags = tag("cpu", "-nb-gene-expr-pred")
107108
}
108109

110+
target "nb-obj-detect" {
111+
inherits = [ "nb-cpu" ]
112+
dockerfile = "docker/Dockerfile.nb-obj-detect"
113+
target = "object-detection"
114+
contexts = {
115+
base = "target:base"
116+
}
117+
tags = tag("cpu", "-nb-obj-detect")
118+
}
119+
109120
target "nb-omnibus" {
110121
inherits = [ "nb-cpu" ]
111122
dockerfile = "docker/Dockerfile.nb-omnibus"
112123
contexts = {
113124
base = "target:base"
114125
nb-image-class = "target:nb-image-class"
115126
nb-gene-expr-pred = "target:nb-gene-expr-pred"
127+
nb-obj-detect = "target:nb-obj-detect"
116128
}
117129
tags = tag("cpu", "-nb-omnibus")
118130
}
@@ -123,6 +135,7 @@ target "gpu-nb-omnibus" {
123135
NB_APT_PKGS_RUN = <<EOF
124136
libjpeg-turbo8 libpng16-16 libgsl23
125137
samtools libhts3 tabix libxml2 libexpat1 libdb5.3 netpbm gnuplot-nox
138+
libjpeg-turbo8 libpng16-16 netpbm gnuplot-nox
126139
EOF
127140
}
128141
dockerfile = "docker/Dockerfile.with-gpu-libtf"

0 commit comments

Comments
 (0)