Skip to content

Commit a9d12a4

Browse files
committed
merged
2 parents bb53912 + ac48380 commit a9d12a4

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

docker/Dockerfile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ RUN ["/bin/bash", "-c", "mim install mmengine"]
2828
RUN ["/bin/bash", "-c", "mim install mmcv==${MMCV}"]
2929

3030
# Install MMSegmentation
31-
RUN echo test
32-
RUN echo test2
33-
RUN echo test3
34-
RUN echo test5
3531
RUN git clone -b main https://github.com/Chrps/mmsegmentation.git /mmsegmentation
3632

3733
WORKDIR /mmsegmentation

docker_run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# TODO: update to make paths more general
2-
docker run --gpus all --shm-size=8g -it -v /media/chrps/wd_external/ambolt/PotentialProjects/Mos/mos_pascal_voc_final:/mmsegmentation/data -v /media/chrps/wd_external/ambolt/PotentialProjects/Mos/mmsegmentation/work_dirs:/mmsegmentation/work_dirs mmsegmentation
2+
docker run --gpus all --shm-size=8g -it -v /media/chrps/wd_external/ambolt/PotentialProjects/Mos/mos_pascal_voc_final:/mmsegmentation/data -v /media/chrps/wd_external/ambolt/PotentialProjects/Mos/mmsegmentation/work_dirs:/mmsegmentation/work_dirs mmsegmentation

inference.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from mmseg.apis import inference_model, init_model, show_result_pyplot
2+
import mmcv
3+
4+
config_file = '/mmsegmentation/work_dirs/pascal_mos/20240402_103935/vis_data/config.py'
5+
checkpoint_file = '/mmsegmentation/work_dirs/pascal_mos/iter_300.pth'
6+
7+
# build the model from a config file and a checkpoint file
8+
model = init_model(config_file, checkpoint_file, device='cuda:0')
9+
10+
# test a single image and show the results
11+
img = '/mmsegmentation/data/JPEGImages/frame_0.jpg' # or img = mmcv.imread(img), which will only load it once
12+
img = mmcv.imread(img)
13+
result = inference_model(model, img)
14+
# visualize the results in a new window
15+
show_result_pyplot(model, img, result, show=True)
16+
# or save the visualization results to image files
17+
# you can change the opacity of the painted segmentation map in (0, 1].
18+
show_result_pyplot(model, img, result, show=True, out_file='result.jpg', opacity=0.5)
19+
# test a video and show the results
20+
#video = mmcv.VideoReader('video.mp4')
21+
#for frame in video:
22+
# result = inference_model(model, frame)
23+
# show_result_pyplot(model, frame, result, wait_time=1)

0 commit comments

Comments
 (0)