zsef123 / connected_components_pytorch Goto Github PK
View Code? Open in Web Editor NEWA PyTorch implementation of Connected Components Labeling
License: BSD 3-Clause "New" or "Revised" License
A PyTorch implementation of Connected Components Labeling
License: BSD 3-Clause "New" or "Revised" License
I tried to compile your code with my c++ code.
However I get the error:
error: ‘atomicMin’ was not declared in this scope
Could you help me?
My CMakeLists looks like this
cmake_minimum_required(VERSION 3.0.0)
project(TTEST VERSION 0.1.0)
include(CTest)
enable_testing()
set(Torch_DIR "/path/to/torch/share/cmake/Torch")
find_package(Torch REQUIRED)
message(STATUS "Torch INCLUDE_DIR:${TORCH_INCLUDE_DIRS}")
message(STATUS "Torch LIBRARIES:${TORCH_LIBRARIES}")
enable_language(CUDA)
message(STATUS "CUDA INCLUDE_DIR:${CUDA_INCLUDE_DIRS}")
message(STATUS "CUDA LIBRARIES:${CUDA_LIBRARIES}")
include_directories("./include") #directory of buf.h
add_executable(TTEST main.cpp buf_3d.cu)
target_link_libraries(TTEST ${TORCH_LIBRARIES} ${CUDA_LIBRARIES})
Hi, thanks for this work... I tried installing it with the latest version of pytorch 1.9, but it doesn't work.
Do you plan to update this to run on the latest version?
Many thanks!
If the 2D code is applied on a tensor that is a 2D slice of a larger tensor, e.g.
x.shape == [B, H, W, C]
correct_out = connected_components_labeling(x[0, :, :, 0].contiguous())
incorrect_out = connected_components_labeling(x[0, :, :, 0])
the expected output correct_out
:
then incorrect_out
will be a weird strided version of the correct_out
:
the input was generated as follows, reusing the example code:
x = torch.tensor(cleared_copy).to("cuda", torch.uint8)[None, :, :, None].repeat(1024, 1, 1, 2)
The quick fix is to call .contiguous()
on every slice, the correct fix would be to either throw an error if the input is not contiguous or take the tensor strides into consideration on the cuda backend.
Hope this might help someone who got unexpected results.
Nevertheless, this implementations is very quick and is an awesome starting point, so thank you! <3
Hello,
I am interested in updating your tool to ensure its compatibility with the programming environment expected in 2024, including support for CUDA 11.8. Could you provide guidance on the necessary modifications or steps required to achieve this?
Thank you for your time and support.
I am not firm with the cuda language. so sorry for that question: How are the label-idx created?
I would expect label to be [0, 1, 2 ....n]
but got [0, 1, 34534, 340394]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.