xiawj-hub / ctlib Goto Github PK
View Code? Open in Web Editor NEWA lib of CT projector and back-projector based on PyTorch
License: MIT License
A lib of CT projector and back-projector based on PyTorch
License: MIT License
Hi Wenjun, when I was trying to pull the docker on Linux 18.04, CUDA 11.3 pytorch 1.10.0, using command 'pull xwj90620/ctlib_pytorch:1.0', it shows permission denied. Do you know why this happens? Thanks.
Best,
Dayang
您好!感谢您的工作,我在安装库运行时报错:
ImportError: DLL load failed while importing ctlib: 找不到指定的模块
在pip list显示已安装ctlib 0.2.0,请教这如何解决?感谢!
环境:Win10, python 3.9, cuda 11.3, torch 11.3.1+cu116。
您好
ImportError: cannot import name '_nt_quote_args' from 'distutils.spawn'
您好!我在安装CTLIB时,遇到上面的问题一直未能解决,请问是怎么回事呢?我的CUDA是10.0,pytorch1.7.0,Python3.7.期待回复谢谢
Hello Teacher:
I really appreciate your great CT geometry library.
I am now implementing "deep image prior" using ctlib library, but I had some errors.
(exactly, I am doing sparse-view CT reconstruction)
For simplicity, I attached my code (Training network parts)
...
input_train = data['input'].to(device) # gaussian
target_train = data['target'].to(device) # sparse-view image
output = net(input_train) # simple UNet
out_for_loss = ctlib.projection(output, option_sparse) # forward projection with sparse view (num of projection views)
out_for_loss = ctlib.fbp(output, option_sparse)
optim.zero_grad()
loss = fn_loss(out_for_loss , target_train )
loss.backward()
optim.step()
train_total_loss += [loss.item()]
....
What I want to do is, the output of network should be reconstructed into sparse-view CT images by applying forward projection and back-projection with option_sparse sequentially and then calculate the MSE loss with target image.
But I encountered a problem with
"RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn"
thus, loss.backward() is not calculated.
For other solutions, people said that write " loss = Variable(loss, requires_grad=True)".
I also did that and aforementioned RuntimeError disappeared, but the loss was not updated (constant for every epoch).
I think the error was caused by directly calculating loss after using 'ctlib.projection' and 'ctlib.fbp' code.
How can I solve this problem?
Hi,
I saw that you opened an issue in the implementation of the paper, "CNN-based morphological decomposition of X-ray images for details and defects contrast enhancement." I trained it a few times but got terrible results.
Did you achieve good results?
Thanks,
您好,请问dImg s2r d2r这三个参数的单位默认是什么呢
您好 请问projection的输入图像是以像素值还是CT值呢?
Hi, it looks like I installed it successfully. But when I import, it shows 'ImportError: libc10.so: cannot open shared object file: No such file or directory' , Do you know why this happens? Thank you very much.
$ python setup.py install
running install
running bdist_egg
running egg_info
writing ctlib.egg-info/PKG-INFO
writing dependency_links to ctlib.egg-info/dependency_links.txt
writing top-level names to ctlib.egg-info/top_level.txt
/home/hrr/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/utils/cpp_extension.py:352: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
warnings.warn(msg.format('we could not find ninja.'))
reading manifest file 'ctlib.egg-info/SOURCES.txt'
writing manifest file 'ctlib.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_ext
creating build/bdist.linux-x86_64/egg
copying build/lib.linux-x86_64-3.7/ctlib.cpython-37m-x86_64-linux-gnu.so -> build/bdist.linux-x86_64/egg
creating stub loader for ctlib.cpython-37m-x86_64-linux-gnu.so
byte-compiling build/bdist.linux-x86_64/egg/ctlib.py to ctlib.cpython-37.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying ctlib.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying ctlib.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying ctlib.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying ctlib.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
writing build/bdist.linux-x86_64/egg/EGG-INFO/native_libs.txt
zip_safe flag not set; analyzing archive contents...
pycache.ctlib.cpython-37: module references file
creating 'dist/ctlib-0.2.0-py3.7-linux-x86_64.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing ctlib-0.2.0-py3.7-linux-x86_64.egg
removing '/home/hrr/anaconda3/envs/pytorch/lib/python3.7/site-packages/ctlib-0.2.0-py3.7-linux-x86_64.egg' (and everything under it)
creating /home/hrr/anaconda3/envs/pytorch/lib/python3.7/site-packages/ctlib-0.2.0-py3.7-linux-x86_64.egg
Extracting ctlib-0.2.0-py3.7-linux-x86_64.egg to /home/hrr/anaconda3/envs/pytorch/lib/python3.7/site-packages
ctlib 0.2.0 is already the active version in easy-install.pth
Installed /home/hrr/anaconda3/envs/pytorch/lib/python3.7/site-packages/ctlib-0.2.0-py3.7-linux-x86_64.egg
Processing dependencies for ctlib==0.2.0
Finished processing dependencies for ctlib==0.2.0
(pytorch) hrr@hzhp-Z10PE-D8-WS:~/Proj/ctlib$ python
Python 3.7.6 (default, Jan 8 2020, 19:59:22)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.import ctlib
Traceback (most recent call last):
File "", line 1, in
ImportError: libc10.so: cannot open shared object file: No such file or directory`
Hi, I tried follow strictly the environment you provided, but it keeps giving me errors like this both in Windows and Linux, can you help me with the installation. I tried StackOverflow, but there is no solution I can find. Thank you very much.
Traceback (most recent call last):
File ~\anaconda3\envs\CT\lib\site-packages\torch\utils\cpp_extension.py:1667 in _run_ninja_build
subprocess.run(
File ~\anaconda3\envs\CT\lib\subprocess.py:516 in run
raise CalledProcessError(retcode, process.args,
CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File E:\research\sparse_view_ct-main\projection_simulatuion\CTLIB\setup.py:4 in <module>
setup(
File ~\anaconda3\envs\CT\lib\site-packages\setuptools\__init__.py:87 in setup
return distutils.core.setup(**attrs)
File ~\anaconda3\envs\CT\lib\site-packages\setuptools\_distutils\core.py:148 in setup
return run_commands(dist)
File ~\anaconda3\envs\CT\lib\site-packages\setuptools\_distutils\core.py:163 in run_commands
dist.run_commands()
File ~\anaconda3\envs\CT\lib\site-packages\setuptools\_distutils\dist.py:967 in run_commands
self.run_command(cmd)
File ~\anaconda3\envs\CT\lib\site-packages\setuptools\dist.py:1214 in run_command
super().run_command(command)
File ~\anaconda3\envs\CT\lib\site-packages\setuptools\_distutils\dist.py:986 in run_command
cmd_obj.run()
File ~\anaconda3\envs\CT\lib\site-packages\setuptools\command\install.py:74 in run
self.do_egg_install()
File ~\anaconda3\envs\CT\lib\site-packages\setuptools\command\install.py:123 in do_egg_install
self.run_command('bdist_egg')
File ~\anaconda3\envs\CT\lib\site-packages\setuptools\_distutils\cmd.py:313 in run_command
self.distribution.run_command(command)
File ~\anaconda3\envs\CT\lib\site-packages\setuptools\dist.py:1214 in run_command
super().run_command(command)
File ~\anaconda3\envs\CT\lib\site-packages\setuptools\_distutils\dist.py:986 in run_command
cmd_obj.run()
File ~\anaconda3\envs\CT\lib\site-packages\setuptools\command\bdist_egg.py:165 in run
cmd = self.call_command('install_lib', warn_dir=0)
File ~\anaconda3\envs\CT\lib\site-packages\setuptools\command\bdist_egg.py:151 in call_command
self.run_command(cmdname)
File ~\anaconda3\envs\CT\lib\site-packages\setuptools\_distutils\cmd.py:313 in run_command
self.distribution.run_command(command)
File ~\anaconda3\envs\CT\lib\site-packages\setuptools\dist.py:1214 in run_command
super().run_command(command)
File ~\anaconda3\envs\CT\lib\site-packages\setuptools\_distutils\dist.py:986 in run_command
cmd_obj.run()
File ~\anaconda3\envs\CT\lib\site-packages\setuptools\command\install_lib.py:11 in run
self.build()
File ~\anaconda3\envs\CT\lib\site-packages\setuptools\_distutils\command\install_lib.py:107 in build
self.run_command('build_ext')
File ~\anaconda3\envs\CT\lib\site-packages\setuptools\_distutils\cmd.py:313 in run_command
self.distribution.run_command(command)
File ~\anaconda3\envs\CT\lib\site-packages\setuptools\dist.py:1214 in run_command
super().run_command(command)
File ~\anaconda3\envs\CT\lib\site-packages\setuptools\_distutils\dist.py:986 in run_command
cmd_obj.run()
File ~\anaconda3\envs\CT\lib\site-packages\setuptools\command\build_ext.py:79 in run
_build_ext.run(self)
File ~\anaconda3\envs\CT\lib\site-packages\setuptools\_distutils\command\build_ext.py:339 in run
self.build_extensions()
File ~\anaconda3\envs\CT\lib\site-packages\torch\utils\cpp_extension.py:708 in build_extensions
build_ext.build_extensions(self)
File ~\anaconda3\envs\CT\lib\site-packages\setuptools\_distutils\command\build_ext.py:448 in build_extensions
self._build_extensions_serial()
File ~\anaconda3\envs\CT\lib\site-packages\setuptools\_distutils\command\build_ext.py:473 in _build_extensions_serial
self.build_extension(ext)
File ~\anaconda3\envs\CT\lib\site-packages\setuptools\command\build_ext.py:202 in build_extension
_build_ext.build_extension(self, ext)
File ~\anaconda3\envs\CT\lib\site-packages\setuptools\_distutils\command\build_ext.py:528 in build_extension
objects = self.compiler.compile(sources,
File ~\anaconda3\envs\CT\lib\site-packages\torch\utils\cpp_extension.py:681 in win_wrap_ninja_compile
_write_ninja_file_and_compile_objects(
File ~\anaconda3\envs\CT\lib\site-packages\torch\utils\cpp_extension.py:1354 in _write_ninja_file_and_compile_objects
_run_ninja_build(
File ~\anaconda3\envs\CT\lib\site-packages\torch\utils\cpp_extension.py:1683 in _run_ninja_build
raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension
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.