Comments (7)
Hi there,
I got it working. I will document here how I did it for other people who are maybe using an M1 Mac.
Prerequisites
I have an M1 Mac with a Python installation via mamba instead of condo/Anaconda
Install a suitable environment
I transferred the requirements.txt
to a environment.yml
. As I am using an M1 Mac I checked if all packages are at least available for an osx-64
Mac which was indeed the case. As this is sometimes tricky with the version numbers of the packages I let loose all the version numbers.
I installed the atoms2.yml
environment via mamba
CONDA_SUBDIR=osx-64 conda env create -f atoms2.yml
.
The environment looks like this:
name: atoms2
channels:
- conda-forge
dependencies:
- boto3
- botocore
- cycler
- decorator
- imageio
- jmespath
- joblib
- kiwisolver
- matplotlib
- networkx
- numpy
- opencv
- pandas
- pillow
- pyparsing
- python-dateutil
- pytz
- pywavelets
- s3transfer
- scikit-image
- scikit-learn
- scipy
- seaborn
- six
- threadpoolctl
- tifffile
- pytorch
- torchvision
- typing-extensions
- urllib3
Now I had to activate the environment via mamba activate atoms2
.
Running the basic detection script
I did not manage to set the Python path correctly. Therefore I copied the dl_detection.py
scripts to the AtomDetection_ACSTEM
folder. I added own data according to your Readme in the repository. I executed the script then via python dl_detection.py dataset/my_data.csv
and it worked as expected.
Enhancements for an M1 Mac
Out of the box it took about 327 seconds to detect the atoms on my picture. The M1 Macs have MP shader cores in their GPU's. I therefore tried to make use of them. I modified the get_torch_device
function to make use of the shaders cores in the following way:
def get_torch_device():
use_mps = torch.backends.mps.is_available()
device = torch.device("mps" if use_mps else "cpu")
return device
When I execute the script now it takes only 114 seconds to run the detection. So I get an increase of nearly a factor of 3 in speed which is quite good for a notebook.
I hope this helps some of the people who would like to make use of it.
from atomdetection_acstem.
Hello Stefan,
I am currently one of the developers of this codebase but we are internally having some issues recovering access to the main account of the repository. Apologies for the delay in replying. As for your particular issues:
- hpai-utils is an internal library of our group, it can be safely removed from dependencies.
- It is relatively normal for the code to take time in analysing the images. As explained in the paper, it does a forward pass per pixel of the image excluding the laterals and corners. However, it may also be that it is running on your CPU instead of GPU. Given that this code is older than the compatibility between Mac GPU & pytorch, the libraries may be doing something funny. Check in this line if the device picked is CPU instead.
- For the last part, it is possible that the working dir is not the same as in dl_replicate_results.sh? I would recommend duplicating the script and changing the particular line to yours.
Let us know if this actions help fix your issues.
Kind regards,
from atomdetection_acstem.
I have an additional question to the developers. Can your work also be used for size distributions?
from atomdetection_acstem.
I have an additional question to the developers. Can your work also be used for size distributions?
What do you mean by size distributions? Variable input image sizes?
from atomdetection_acstem.
I mean you are counting the atom clusters but instead of a number could one also get a distribution of the size of the clusters?
from atomdetection_acstem.
Hello again Stefan,
The output of the program itself is not a count of atom clusters, but rather the predicted positions of the metallic atoms within the image.
An important caveat is that clusters of atoms may be slightly miss-represented in this version of the code, as the algorithm tended to merge metallic atoms that were too close together by usage of a suboptimal heuristic. We fixed these problems in our follow-up work: https://onlinelibrary.wiley.com/doi/abs/10.1002/adma.202307991
This newer version also returns the positions of atoms, but with better performance for clusters.
That being said, if I understand your question correctly, the predicted positions can be used to infer pixel-distance between atom centroids. If you work with images for which you know the pixels/nanometer scale, you should be able to find cliques of predicted atoms that are sufficiently close and use these to compute several types of size statistics.
from atomdetection_acstem.
Hello there,
thank you for pointing to the new manuscript. We will try to evaluate if it fits our systems and maybe I have to come back to you with more questions!
from atomdetection_acstem.
Related Issues (2)
- Publication HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from atomdetection_acstem.