Skip to content

Commit

Permalink
Fixed linting
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasreljic committed Jun 14, 2024
1 parent d115d94 commit 1392fda
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ WORKDIR ${AMENT_WS}/src
RUN git clone -b main https://github.com/open-mmlab/mmsegmentation.git /mmsegmentation
WORKDIR /mmsegmentation
ENV FORCE_CUDA="1"
#RUN pip install -r requirements.txt
RUN pip install mmengine
RUN pip install --no-cache-dir -e .
RUN ["/bin/bash", "-c", "pip install openmim"]

# Scan for dependencies
RUN echo "openmim\nmmengine\nmmcv==2.0.1\n" > /tmp/pip_install_list.txt

# Install segformer model
RUN mim download mmsegmentation --config segformer_mit-b2_8xb1-160k_cityscapes-1024x1024 --dest ./model

# # ################################ Source ################################
Expand All @@ -50,8 +50,6 @@ RUN apt-get -qq update && rosdep update && \
################################# Dependencies ################################
FROM ${BASE_BUILD_IMAGE} as dependencies

# # install tensorrt
# RUN apt update && apt install -y tensorrt
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub

Expand All @@ -68,7 +66,7 @@ RUN apt-get update && apt-get install -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*


# Install Segformer dependencies
COPY --from=Segformer /tmp/pip_install_list.txt /tmp/pip_install_list.txt
RUN pip3 install torch==1.13.1+cu116 torchvision==0.14.1+cu116 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu116
RUN pip install cython
Expand Down Expand Up @@ -109,7 +107,6 @@ COPY --from=Segformer /mmsegmentation /mmsegmentation
RUN pip install -r requirements.txt
RUN pip install --no-cache-dir -e .
WORKDIR ${AMENT_WS}
# --from=Segformer /mmsegmentation/model /model
# Add runtime libraries to path
ENV CUDNN_DIR=/mmsegmentation/cuda
ENV CV2_CUDABACKEND=0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def generate_launch_description():
executable='semantic_segmentation_node',
name='semantic_segmentation_node',
parameters=[config]
)
)

# finalize
ld.add_action(semantic_segmentation_node)
Expand Down
Binary file not shown.
12 changes: 0 additions & 12 deletions src/perception/semantic_segmentation/resource/deploy.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@
package_name = 'semantic_segmentation'
package_share_directory = get_package_share_directory(package_name)
CONFIG = os.path.join(package_share_directory, 'resource', 'model',
'segformer_mit-b2_8xb1-160k_cityscapes-1024x1024.py')
CHECKPOINT = os.path.join(package_share_directory, 'resource', 'model',
'segformer_mit-b2_8x1_1024x1024_160k_cityscapes_20211207_134205-6096669a.pth')

'segformer_mit-b2_8xb1-160k_cityscapes-1024x1024.py')
CHECKPOINT = os.path.join(package_share_directory, 'resource', 'model',
'segformer_mit-b2_8x1_1024x1024_160k_cityscapes_20211207_134205-6096669a.pth')
IMAGE_H = 900
IMAGE_W = 1600

Expand Down Expand Up @@ -106,13 +105,13 @@ def listener_callback(self, msg):
except CvBridgeError as e:
self.get_logger().error(str(e))
return

with torch.no_grad():
out_img = self.model(image, show=False, )['predictions']

# logits = torch.tensor(out_img, dtype=torch.float32).unsqueeze(0).unsqueeze(0) # Add batch and channel dimensions
out_img = self.model(image, show=False, )['predictions']
# logits = torch.tensor(
# out_img, dtype=torch.float32).unsqueeze(0).unsqueeze(0)
# Add batch and channel dimensions
# upsampled_logits = torch.nn.functional.interpolate(logits,

Check failure on line 113 in src/perception/semantic_segmentation/semantic_segmentation/segmentation_node.py

View workflow job for this annotation

GitHub Actions / Autopep8

src/perception/semantic_segmentation/semantic_segmentation/segmentation_node.py#L106-L113

self.get_logger().error(str(e)) return with torch.no_grad(): - out_img = self.model(image, show=False, )['predictions'] + out_img = self.model(image, show=False, )['predictions'] # logits = torch.tensor( # out_img, dtype=torch.float32).unsqueeze(0).unsqueeze(0) # Add batch and channel dimensions
# size=(IMAGE_H, IMAGE_W), # (height, width)
# size=(IMAGE_H, IMAGE_W), # (height, width)
# mode='bilinear',
# align_corners=False)
# upsampled_logits = upsampled_logits.squeeze().numpy().astype(np.uint8)
Expand Down

0 comments on commit 1392fda

Please sign in to comment.