9월, 2021의 게시물 표시

Access jupyter notebook using docker

I searched for dev container, not runtime, but couldn't find it. This method uses some tricks - not using the notebook's default port, etc. 1. Run docker container docker run -it -p 8880:8880 --name jpt -v /home/hayoung/Desktop/:/data jupyter/datascience-notebook:latest 2. Check your container's id (Use another terminal, or stop the current container and check) docker ps -a 3. Get inside of the container docker exec -it {your container's id} /bin/bash 4. Run a new notebook jupyter notebook --no-browser --allow-root --port 8880 --ip=0.0.0.0 --NotebookApp.password={your notebook's password hash} --notebook-dir='/' (You can get your hash by running python and executing "from notebook.auth import passwd; passwd()" in the host machine)  ref: https://bio-info.tistory.com/12 https://manvscloud.com/?p=385

Updating git submodule

-  이미 추가된 submodule의 최신 commit으로 업데이트 할 경우 상위 깃: A submodule: B cd B # 현재 최신 커밋이 올라온 브랜치로 변경. 현재 브랜치는 submodule로 생성된 임시(?) 브랜치임 git checkout {branch_name} # 필요시 pull: git pull origin {branch_name} cd .. git add B git commit -m "{commit message}" git push origin {branch_name} submodule 안의 코드를 수정하고, my_branch에 커밋한 뒤 상위 깃에서 add 혹은 git submodule update을 수행해도 변경사항이 적용되지 않는 이유가 my_branch가 아닌 해시로 보이는 다른 브랜치가 생성되어 submodule이 그 브랜치를 추종하고 있기 때문이었음

Save matplotlib figure image

https://stackoverflow.com/questions/8218608/scipy-savefig-without-frames-axes-only-content   import matplotlib . pyplot as plt import cv2 from skimage import measure image = cv2 . imread ( "/data/temp/image.png" ) mask = cv2 . imread ( "/data/temp/mask.png" , - 1 ) * 255 contours = measure . find_contours ( mask , 200 ) fig = plt . figure ( frameon = False ) # fig.set_size_inches(w, h) ax = plt . Axes ( fig , [ 0 ., 0 ., 1 ., 1 .]) ax . set_axis_off () fig .add_axes( ax ) ax . imshow ( image , aspect = "auto" ) for contour in contours : ax . plot ( contour [:, 1 ], contour [:, 0 ], linewidth = 1 , label = "class 1" , color =) ax . legend () fig .savefig( "/data/temp/temp.png" , format = "png" )