Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

created docker #15

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/model/
9 changes: 6 additions & 3 deletions demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
from nets import txtbox_384, np_methods, txtbox_768
from processing import ssd_vgg_preprocessing

os.environ['CUDA_VISIBLE_DEVICES'] = '3' #using GPU 0
os.environ['CUDA_VISIBLE_DEVICES'] = '0' #using GPU 0
class MyError(Exception):
pass

def plt_bboxes(img, classes, scores, bboxes, figsize=(10,10), linewidth=1.5):
"""Visualize bounding boxes. Largely inspired by SSD-MXNET!
Expand Down Expand Up @@ -59,13 +61,14 @@ def plt_bboxes(img, classes, scores, bboxes, figsize=(10,10), linewidth=1.5):
with slim.arg_scope(txt_net.arg_scope(data_format=data_format)):
predictions,localisations, logits, end_points = txt_net.net(image_4d, is_training=False, reuse=reuse)

ckpt_dir = 'model'
ckpt_dir = 'model/ckpt'

isess.run(tf.global_variables_initializer())

saver = tf.train.Saver()

ckpt_filename = tf.train.latest_checkpoint(ckpt_dir)

if ckpt_dir and ckpt_filename:
print('checkpoint:',ckpt_dir, os.getcwd(), ckpt_filename)
saver.restore(isess, ckpt_filename)
Expand Down Expand Up @@ -108,5 +111,5 @@ def process_image(img, select_threshold=0.01, nms_threshold=.45, net_shape=net_s
cv2.imwrite(os.path.join(path,'demo_res.png'), img_with_bbox)
print('detection finished')
else:
raise ('no ckpt')
raise MyError('no ckpt')

Binary file added demo/demo_res.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
151 changes: 151 additions & 0 deletions demo/detections.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
[2.88985550e-01 1.89993531e-04 3.87580574e-01 1.19108364e-01
2.94231325e-01 3.90329778e-01 3.81841898e-01 2.86417544e-01
0.00000000e+00 0.00000000e+00 1.18270762e-01 1.12579495e-01],0.9995779395103455
[0.38549194 0.26399544 0.41888657 0.28378657 0.38476145 0.41981596
0.42098278 0.38525108 0.26556456 0.2634933 0.28191188 0.28408992],0.13853231072425842
[0.37856135 0.21359646 0.42704067 0.2325184 0.37469703 0.43053952
0.43130085 0.37514004 0.21495566 0.21259254 0.23082069 0.23323618],0.1376979798078537
[0.37052733 0.21796481 0.4066201 0.23518084 0.37009767 0.40986952
0.40951777 0.36948943 0.21879245 0.21724895 0.23456654 0.23620144],0.12119055539369583
[0.2988583 0.15915345 0.36726704 0.17857681 0.2982701 0.36595303
0.36613786 0.29825857 0.15938807 0.15925959 0.17802128 0.17830232],0.12064102292060852
[0.28792003 0.27320302 0.32451227 0.29488844 0.28700146 0.32558355
0.32599002 0.28735977 0.27442825 0.27355263 0.29347417 0.2945559 ],0.11698590964078903
[0.2932861 0.21804348 0.32282746 0.23899597 0.29296803 0.32385376
0.32457647 0.29374787 0.21895269 0.21728966 0.23822518 0.23994833],0.11139918863773346
[0.37225416 0.26875708 0.40269676 0.28703603 0.3710854 0.4032345
0.4042125 0.37152678 0.27017817 0.267655 0.2854868 0.28787184],0.10660593956708908
[0.3611377 0.16034338 0.39130974 0.17569539 0.3568697 0.39458898
0.3944647 0.35663486 0.16061471 0.16026877 0.17546748 0.17606913],0.10641516000032425
[0.3855923 0.25239983 0.42505953 0.27327225 0.38337195 0.4242385
0.4270231 0.3859473 0.25501734 0.25129017 0.27165973 0.2749297 ],0.10381390899419785
[0.38487315 0.22918153 0.41897118 0.2460427 0.38345683 0.42160708
0.4208569 0.38332105 0.22893527 0.22908947 0.24601603 0.24581629],0.10228018462657928
[0.33382192 0.24422216 0.3565553 0.26151717 0.33377758 0.3566872
0.3572007 0.33410254 0.24304089 0.243912 0.2642244 0.26336706],0.10159362107515335
[0.34264562 0.21691042 0.38925353 0.240053 0.3340438 0.39672497
0.3967302 0.33345544 0.21931683 0.21752551 0.23836882 0.239979 ],0.09999583661556244
[0.3797448 0.2391271 0.3958492 0.2534562 0.37840697 0.39676765
0.3970912 0.37859616 0.23700608 0.23621911 0.25543416 0.25668776],0.0985521525144577
[0.36410898 0.22968625 0.3883553 0.24432655 0.36211586 0.3913849
0.39152846 0.36162817 0.22872719 0.22916782 0.2445223 0.24432662],0.09842731058597565
[0.334151 0.2684892 0.3567144 0.28580895 0.33381546 0.3572911
0.35792467 0.33399776 0.26543492 0.26661766 0.2887121 0.28796008],0.09811659902334213
[0.3881794 0.24383833 0.42062417 0.2605134 0.38645276 0.4232188
0.42327386 0.38638848 0.24493958 0.24367906 0.26003635 0.26087233],0.09714052081108093
[0.3188047 0.2206515 0.34997115 0.2373344 0.31745803 0.35131645
0.3511047 0.31717783 0.2209742 0.22038938 0.23707548 0.23793459],0.09667378664016724
[0.36091375 0.21838708 0.38564616 0.2343149 0.35876152 0.38902745
0.388896 0.35844788 0.21824989 0.21764638 0.23457466 0.23518252],0.09645641595125198
[0.35043323 0.26490653 0.37339175 0.28252333 0.34878498 0.37396127
0.3752136 0.34974813 0.26377034 0.26206407 0.2863281 0.28645223],0.09643791615962982
[0.28953895 0.25947452 0.32325307 0.28016627 0.28872535 0.3228072
0.32397392 0.28982645 0.26021054 0.2604729 0.27957398 0.2805207 ],0.09624025970697403
[0.28956482 0.22473806 0.3180186 0.2437545 0.28967378 0.3189703
0.3189043 0.28981027 0.22432081 0.2245456 0.24377622 0.2438991 ],0.09580737352371216
[0.35457385 0.24331537 0.37353945 0.26006588 0.353025 0.37381804
0.3751986 0.35428247 0.23993427 0.23862417 0.2626684 0.26453093],0.09578830748796463
[0.3070809 0.2759555 0.3271509 0.29143196 0.30599448 0.32744917
0.3283856 0.30695927 0.2752405 0.2749722 0.29160428 0.29251823],0.09567928314208984
[0.35123783 0.2539745 0.37341058 0.27032447 0.34998685 0.3746993
0.37448207 0.34992793 0.25212947 0.25266927 0.27310097 0.27413878],0.09567035734653473
[0.33468243 0.23142572 0.3557755 0.24728553 0.33512694 0.35568777
0.3554063 0.3349991 0.23003718 0.23220024 0.25059038 0.24902046],0.09564457088708878
[0.3811407 0.26935738 0.39685827 0.28439397 0.37962916 0.39717674
0.39783508 0.38012174 0.26670384 0.26474178 0.28653717 0.28760535],0.09509573876857758
[0.37200102 0.23079646 0.4037749 0.2464244 0.36959672 0.4079272
0.40824488 0.36968857 0.23087128 0.23000155 0.24609485 0.24686857],0.09439694881439209
[0.38631395 0.27178138 0.41799 0.28967327 0.38435864 0.42026332
0.4210771 0.38507435 0.2726863 0.27136782 0.2886321 0.2896374 ],0.09383638203144073
[0.2990052 0.22838156 0.32753527 0.24390186 0.29984996 0.3284176
0.32824358 0.29962584 0.22765826 0.22813936 0.24410418 0.24385208],0.09383188188076019
[0.33463356 0.2523799 0.35625818 0.2715627 0.33492497 0.35624576
0.35674918 0.33520073 0.24938808 0.24921894 0.27453777 0.27490765],0.09380143880844116
[0.36537153 0.24428093 0.39133632 0.25952643 0.3610333 0.39601403
0.39631253 0.36107767 0.24447952 0.24406219 0.25989008 0.26018363],0.09373550862073898
[0.33608022 0.2778618 0.3548759 0.2992958 0.33490288 0.35386735
0.3561661 0.33711195 0.27355096 0.27104276 0.30421484 0.3068045 ],0.09318673610687256
[0.3488543 0.21972984 0.37696874 0.23569643 0.34815246 0.37915197
0.37862465 0.34797806 0.2200214 0.21930367 0.236029 0.23658971],0.0929281935095787
[0.38442376 0.16076753 0.4096144 0.17684063 0.38701162 0.40645808
0.40591016 0.38675284 0.16115534 0.16064645 0.1765936 0.17685592],0.0926404520869255
[0.381337 0.2778159 0.3966021 0.29566935 0.37976182 0.39641744
0.39829373 0.38171324 0.27636725 0.27450287 0.29751572 0.29981062],0.09256536513566971
[0.32403728 0.27475965 0.35020712 0.29119062 0.3230879 0.3516124
0.35110608 0.3224405 0.2746843 0.27433047 0.29107276 0.2913881 ],0.09232839941978455
[0.38481283 0.21955878 0.42021382 0.24137858 0.3834887 0.42047492
0.4209187 0.38405693 0.22118652 0.21935895 0.24076079 0.24294794],0.09199918806552887
[0.38279685 0.20796782 0.42336693 0.22627926 0.3790801 0.42684796
0.42664868 0.3791422 0.20935076 0.20715767 0.22446139 0.22664769],0.09120065718889236
[0.30925545 0.2640738 0.32846078 0.28099018 0.3092513 0.328363
0.32886654 0.3100425 0.26469886 0.26394486 0.2807222 0.28137118],0.09076700359582901
[0.3180498 0.2286327 0.34596884 0.2433782 0.31632635 0.34998593
0.3500034 0.31629232 0.22790712 0.22817191 0.24397638 0.24374601],0.09075779467821121
[0.30200332 0.20593055 0.3426658 0.22620751 0.3000676 0.34669882
0.34608093 0.2998542 0.2072703 0.20613296 0.2255905 0.22676183],0.0905514657497406
[0.33046338 0.19312811 0.36449245 0.2176705 0.33109015 0.36323112
0.36292478 0.3307603 0.19173585 0.19328783 0.21962783 0.21809146],0.09039274603128433
[0.35417116 0.27586758 0.3734426 0.29666913 0.35215273 0.37230211
0.3754013 0.35526636 0.2704474 0.26813766 0.30213898 0.30452633],0.090290866792202
[0.30790246 0.2525854 0.32711327 0.26749086 0.30723622 0.32642013
0.32765654 0.3084895 0.25357088 0.2539841 0.26696393 0.26752636],0.09028299152851105
[0.3016163 0.21972872 0.33809936 0.24010791 0.30091292 0.3409158
0.34068522 0.30018693 0.21962146 0.21996373 0.2397758 0.23956718],0.0898827612400055
[0.33069834 0.2211406 0.36320546 0.24605522 0.3311646 0.3620435
0.3611599 0.33086774 0.21826482 0.21955101 0.24892712 0.2486718 ],0.08980044722557068
[0.30522007 0.27041766 0.3334986 0.2867597 0.30552775 0.33319807
0.33302662 0.3052532 0.2703521 0.27091563 0.2870253 0.28647676],0.08967608958482742
[0.3792717 0.22031838 0.39703667 0.23666853 0.37869227 0.39787596
0.39749265 0.37860936 0.21944147 0.21930774 0.23901856 0.23903333],0.08956493437290192
[0.3800608 0.24758849 0.39576298 0.2633889 0.37887707 0.39692357
0.397537 0.37949538 0.24637972 0.24543974 0.26534426 0.26727107],0.08953192085027695
[0.3825724 0.26086736 0.39965785 0.27445138 0.38161328 0.4005984
0.40134373 0.38164803 0.26074156 0.26033834 0.27615133 0.27695888],0.08907287567853928
[0.28522345 0.22724114 0.3242992 0.2533579 0.28524607 0.32386065
0.32463315 0.285986 0.22822358 0.2293289 0.25291553 0.25221533],0.08892112225294113
[0.37550032 0.2440276 0.41002756 0.2638235 0.3725828 0.41163087
0.41249692 0.37305945 0.24516875 0.24302992 0.26224464 0.26477408],0.08864881098270416
[0.3299771 0.2054051 0.36301303 0.23134299 0.33026126 0.36134025
0.36205426 0.3309604 0.20599389 0.20494696 0.23230445 0.23403761],0.08843179047107697
[0.3700718 0.2620316 0.39392856 0.2771163 0.36817002 0.39634538
0.39668524 0.36815214 0.26149413 0.26147962 0.27756158 0.2780843 ],0.08831866085529327
[0.29632857 0.22572495 0.33908662 0.24997805 0.29514614 0.34129962
0.34102905 0.29482478 0.22600293 0.2271613 0.24935186 0.24852048],0.08707361668348312
[0.34461415 0.23978661 0.3940615 0.26432458 0.3346833 0.4022808
0.40257663 0.33458143 0.24240083 0.24128024 0.26216653 0.26344085],0.08657103776931763
[0.35184464 0.22943917 0.37363353 0.24610159 0.35137343 0.37473536
0.37417847 0.3511353 0.22843784 0.22813359 0.24939023 0.24920031],0.08638913184404373
[0.37367958 0.20620878 0.40953928 0.22227217 0.3696485 0.41343254
0.4139151 0.37016374 0.20772764 0.20564327 0.22007667 0.22243823],0.08612024784088135
[0.3090511 0.27998826 0.3316337 0.29860273 0.3083078 0.33177778
0.33287114 0.30932474 0.28054598 0.2782646 0.29788482 0.30048344],0.08576349914073944
[0.33030677 0.23466925 0.37080884 0.25917053 0.32728633 0.37206376
0.37270454 0.32852802 0.23468085 0.23539859 0.25998807 0.25998595],0.08570306748151779
[0.37818798 0.18956527 0.41668758 0.20796898 0.373479 0.42015254
0.4202462 0.37303746 0.19078146 0.18962055 0.20685221 0.20795558],0.08557334542274475
[0.37122384 0.16042766 0.4022725 0.17850226 0.3712989 0.40397492
0.40372598 0.3710651 0.16035374 0.15998742 0.17847039 0.17885722],0.08521613478660583
[0.29946312 0.28604192 0.33271888 0.3027706 0.29767114 0.33470672
0.3352235 0.29770008 0.2864701 0.28494018 0.301357 0.3030581 ],0.08479525148868561
[0.38893673 0.23420407 0.41241786 0.25339317 0.3876996 0.41083035
0.41338205 0.3902711 0.23702422 0.23264839 0.25079754 0.25498813],0.08465313166379929
[0.2982125 0.23707832 0.33527806 0.26029527 0.29654765 0.3366287
0.33706045 0.29750988 0.2377521 0.23926705 0.26082176 0.26036924],0.08440236002206802
[0.2923161 0.26739374 0.31661382 0.28698745 0.29150167 0.31563345
0.31707856 0.29279652 0.26670775 0.26423416 0.2866119 0.28927636],0.08404244482517242
[0.3577382 0.26213828 0.39061975 0.2851154 0.3539992 0.39111644
0.39300558 0.35631043 0.26327914 0.2607911 0.28501913 0.2875218 ],0.08392743766307831
[0.31246525 0.25815463 0.32928532 0.27409518 0.31205836 0.32956347
0.33030078 0.31236768 0.2581361 0.2563572 0.2727943 0.2750005 ],0.08381441235542297
[0.3433496 0.19981414 0.37977257 0.23029652 0.34440705 0.37890264
0.37924698 0.3446476 0.20217308 0.1980111 0.23088735 0.2340639 ],0.08364637196063995
[0.33955127 0.18246776 0.36392874 0.20851505 0.33790284 0.3646019
0.36635742 0.33980224 0.17876968 0.17752236 0.2145005 0.21514384],0.08311699330806732
[0.34548333 0.18763027 0.3809326 0.21637273 0.34607518 0.37978232
0.37974676 0.34604225 0.18810762 0.1849787 0.21699792 0.22000566],0.08311168849468231
[0.3747268 0.2761144 0.40733895 0.29345894 0.37284163 0.41027138
0.41057047 0.37301025 0.277005 0.27575755 0.29266974 0.29392585],0.08310286700725555
[0.2884765 0.23969772 0.32049635 0.25764108 0.2881738 0.32184726
0.32185864 0.28829783 0.23960947 0.24046022 0.25784197 0.25680608],0.08308304101228714
[0.30784383 0.2391661 0.32533875 0.2527428 0.30818924 0.3244034
0.324704 0.30857438 0.24001619 0.24189016 0.25251576 0.25130737],0.08287431299686432
25 changes: 25 additions & 0 deletions docker_model/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04

RUN apt-get update && \
apt-get install -y \
nano less tree \
python3.5 \
python3-pip \
libgl1-mesa-glx \
libglib2.0-0 \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

WORKDIR /workspace
COPY requirements.txt .


RUN pip3 install --upgrade pip
RUN pip3 install -r requirements.txt

RUN ln -s /usr/local/cuda/lib64/stubs/libcuda.so /usr/local/cuda/lib64/stubs/libcuda.so.1
# RUN =/usr/local/cuda/lib64/stubs:/usr/local/nvidia/lib:/usr/local/nvidia/lib64
ENV LD_LIBRARY_PATH="/usr/local/cuda/lib64/stubs:${PATH}"


20 changes: 20 additions & 0 deletions docker_model/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
IMAGE_TAG := "txpptf"

build:
docker build -t ${IMAGE_TAG} -f Dockerfile ../

run:
# Make sure directories exist to prevent permission issues
docker run \
--rm \
-v `pwd`/..:/workspace \
${IMAGE_TAG}

interactive:
# Make sure directories exist to prevent permission issues
docker run \
-it \
--rm \
-v `pwd`/..:/workspace \
${IMAGE_TAG} \
/bin/bash
2 changes: 2 additions & 0 deletions docker_model/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- requirements: you need to install nvidia docker from https://github.com/NVIDIA/nvidia-docker
- use `make build` to build the docker and `make interactive` to get inside and work interactively.
Binary file modified nets/__pycache__/__init__.cpython-35.pyc
Binary file not shown.
Binary file modified nets/__pycache__/custom_layers.cpython-35.pyc
Binary file not shown.
Binary file modified nets/__pycache__/np_methods.cpython-35.pyc
Binary file not shown.
Binary file modified nets/__pycache__/textbox_common.cpython-35.pyc
Binary file not shown.
Binary file modified nets/__pycache__/txtbox_384.cpython-35.pyc
Binary file not shown.
Binary file modified nets/__pycache__/txtbox_768.cpython-35.pyc
Binary file not shown.
Binary file modified processing/__pycache__/__init__.cpython-35.pyc
Binary file not shown.
Binary file modified processing/__pycache__/ssd_vgg_preprocessing.cpython-35.pyc
Binary file not shown.
Binary file modified processing/__pycache__/tf_image.cpython-35.pyc
Binary file not shown.
17 changes: 17 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
absl-py==0.11.0
astor==0.8.1
bleach==1.5.0
gast==0.4.0
grpcio==1.33.2
html5lib==0.9999999
importlib-metadata==2.0.0
Markdown==3.2.2
numpy==1.18.5
opencv-python==4.4.0.42
protobuf==3.14.0
six==1.15.0
tensorboard==1.8.0
tensorflow-gpu==1.8.0
termcolor==1.1.0
Werkzeug==1.0.1
zipp==1.2.0
Binary file modified tf_extended/__pycache__/__init__.cpython-35.pyc
Binary file not shown.
Binary file modified tf_extended/__pycache__/bboxes.cpython-35.pyc
Binary file not shown.
Binary file modified tf_extended/__pycache__/image.cpython-35.pyc
Binary file not shown.
Binary file modified tf_extended/__pycache__/math.cpython-35.pyc
Binary file not shown.
Binary file modified tf_extended/__pycache__/metrics.cpython-35.pyc
Binary file not shown.
Binary file modified tf_extended/__pycache__/tensors.cpython-35.pyc
Binary file not shown.