Coder Social home page Coder Social logo

alliedtoasters / pycda Goto Github PK

View Code? Open in Web Editor NEW
15.0 15.0 7.0 61.61 MB

PyCDA: Simple Crater Detection

Home Page: http://pycda.readthedocs.io/en/latest/

License: MIT License

Python 4.53% Jupyter Notebook 95.47%
astronomy astrophysics cda crater-detection machine-learning neural-network planetary pre-alpha pypi python science

pycda's Introduction

PyCDA: Simple Crater Detection

Go from image to crater annotations in minutes.

PyCDA is a crater detection algorithm (CDA) written in Python.

Inspired by research in applying convolutional neural networks to crater detection (Benedix et al.) and crater candidate classification (Cohen et al.), PyCDA is aimed at making CDA research modular and usable.

The current release, pre-alpha "fun" 0.1.14, is a conceptual demonstration; its general performance on some datasets is too poor for use; however, it will yield crater detections.

Getting Started

At its most basic level, PyCDA is built to be easy to use, and that should start with installation; pre-alpha "fun" version 0.1.14 is now available via PyPI with:

pip install pycda

Prerequisites

PyCDA currently supports Python 3.6; we recommend using a virtual environment or environment manager such as conda, as PyCDA has not been tested on previous versions of its dependencies.

Installing

PyCDA's current release, "fun" 0.1.14, is a prototype pre-release. However, it is available for download via PyPi for the adventurous. From your python 3.6 environment, install with pip via the command line:

pip install pycda

Using PyCDA

For a quick prediction "out of the box," use the commands:

from pycda import CDA, load_image

cda = CDA()
image = load_image('my_image_filepath.png')
detections = cda.predict(image)

The output of the call to .predict is a pandas dataframe, with columns 'lat' (crater location from top of image), 'long' (crater location from left edge of image), and diameter' (crater diameter in pixels).

PyCDA currently handles image using PIL; image files from disc must therefore be in the formats that PIL supports. Numpy arrays of raster images are also supported; pass them in as you would an image object.

PyCDA provides visualization and error analysis tools as well; check out the demo notebook for a peek at these features!

Documentation on the entire project is available here.

Running the tests

Test your installation with test.py, available from this repo. With wget:

wget https://raw.githubusercontent.com/AlliedToasters/PyCDA/master/test.py

Then, run

python test.py

Versioning

PyCDA follows something like SemVer guidelines, the current release is "fun" 0.1.14 and is still in early development. I fixed the data file loading issues that came with 'super top secret pre-alpha release 0.1.1', and we finally have something that does something "out of the box."

Authors

Contributing

PyCDA is a community project and we welcome anybody in the CDA research community, planetary scientists, or Python developers to the fold. Please reach out to Michael Klear at:

[email protected]

-or-

[email protected]

to contribute!

License

This project is licensed under the MIT License - see the LICENSE.md file for details

pycda's People

Contributors

alliedtoasters avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

pycda's Issues

Issue about get_predictions

Good morning.
I am trying to use the PyCDA algorithm but I encounter the following issue when I try to use it on a HiRISE picture:

image

The test picture has black parts but I get the same error message even if I remove them.

image

Thank you for your help.

CustomClassifier doesn't handle channel-free models

An issue was brought to my attention that appears to be related to custom classifier models that do not expect color channels in input images. A test case has been added in the branch custom_classifier that reproduces this issue with the following traceback:

E

.

......
======================================================================
ERROR: test_custom_classifier (__main__.TestImageFlow)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/mklear/PyCDA/test.py", line 125, in test_custom_classifier
    cls = CustomClassifier('./pycda/models/no_channels_model.h5', crater_pixels=6)
  File "/Users/mklear/PyCDA/pycda/classifiers.py", line 66, in __init__
    self.input_channels = input_layer.input_shape[3]
IndexError: tuple index out of range

----------------------------------------------------------------------
Ran 11 tests in 3.570s

FAILED (errors=1)

I am currently working to solve this issue.

cda = CDA () error

Installation went well but when I typed the following thing i.e. cda = CDA().
I am getting the following error
`>>> cda = CDA()
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\ProgramData\Anaconda3\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\ProgramData\Anaconda3\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 1, in
File "C:\ProgramData\Anaconda3\lib\site-packages\pycda_init_.py", line 46, in init
self.detector = detectors.get(detector)
File "C:\ProgramData\Anaconda3\lib\site-packages\pycda\detectors.py", line 158, in get
return model_dictionaryidentifier
File "C:\ProgramData\Anaconda3\lib\site-packages\pycda\detectors.py", line 64, in init
import tensorflow as tf
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_init_.py", line 101, in
from tensorflow_core import *
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core_init_.py", line 40, in
from tensorflow.python.tools import module_util as module_util
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_init
.py", line 50, in getattr
module = self.load()
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_init
.py", line 44, in _load
module = importlib.import_module(self.name)
File "C:\ProgramData\Anaconda3\lib\importlib_init
.py", line 127, in import_module
return _bootstrap.gcd_import(name[level:], package, level)
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\python_init
.py", line 49, in
from tensorflow.python import pywrap_tensorflow
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 74, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\ProgramData\Anaconda3\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\ProgramData\Anaconda3\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.

Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.