{"id":15288155,"url":"https://github.com/qiancao/hskl","last_synced_at":"2025-04-13T07:36:48.604Z","repository":{"id":62569535,"uuid":"343179374","full_name":"qiancao/hskl","owner":"qiancao","description":"A library for hyperspectral image analysis using scikit-learn.","archived":false,"fork":false,"pushed_at":"2021-04-01T19:15:25.000Z","size":592,"stargazers_count":9,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-17T17:17:56.659Z","etag":null,"topics":["hyperspectral","image-analysis-toolbox","machine-learning","scikit-learn"],"latest_commit_sha":null,"homepage":"https://github.com/qiancao/hskl","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/qiancao.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-28T18:18:02.000Z","updated_at":"2023-11-20T01:49:42.000Z","dependencies_parsed_at":"2022-11-03T17:15:33.345Z","dependency_job_id":null,"html_url":"https://github.com/qiancao/hskl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qiancao%2Fhskl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qiancao%2Fhskl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qiancao%2Fhskl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qiancao%2Fhskl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qiancao","download_url":"https://codeload.github.com/qiancao/hskl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240045016,"owners_count":19739186,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hyperspectral","image-analysis-toolbox","machine-learning","scikit-learn"],"created_at":"2024-09-30T15:44:27.349Z","updated_at":"2025-02-23T02:30:39.468Z","avatar_url":"https://github.com/qiancao.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HSKL: Hyperspectral-scikit-learn\n\nHyperspectral image analysis using *scikit-learn*\n\n## Installation\n\nThe package can be installed using `pip`:\n\n`pip install hskl`\n\nOr install HSKL directly from the repository:\n\n1. Verify that git is installed:\n\n    `git --version`\n\n2. Install HSKL:\n\n    `pip install git+https://github.com/qiancao/hskl.git`\n\n## Usage\n\nTraining a pixel-level classifier for segmentation:\n\n```python\nimport os\n\nfrom hskl.demo import dl_hyrank, load_hyrank\nimport hskl.classification as classification\nimport hskl.utils as utils\n\n# Download, unpack, and load HyRANK dataset from current directory.\npath = os.getcwd()\nif not os.path.exists(\"HyRANK_satellite\"):\n    dl_hyrank(path)    \nimages, labels, _ = load_hyrank(path)\n\n# Dimensional reduction using PCA, retain 99.9% image variance\npca = utils.pca_fit(images[0])\ntrain, _ = utils.pca_apply(images[0], pca, 0.999)\ntest, _ = utils.pca_apply(images[1], pca, 0.999)\nlabel = labels[0]\ntest_mask = labels[1]\u003e0\n\n# Train a classifier and predict test image labels\ncl = classification.HyperspectralClassifier(\n         method_name=\"LinearDiscriminantAnalysis\")\ncl.fit(train, label)\nprediction = cl.predict(test)\n\n# Visualization of training data, test prediction, and test ground truth\nfig_objs_train = utils.overlay(train,label)\nutils.save_overlay(fig_objs_train, \"hyrank_train.png\")\n\nfig_objs_predict = utils.overlay(test,prediction*test_mask)\nutils.save_overlay(fig_objs_predict, \"hyrank_predict.png\")\n\nfig_objs_test = utils.overlay(test,labels[1])\nutils.save_overlay(fig_objs_test, \"hyrank_test.png\")\n```\nOutput:\n\nTraining image and ground truth labels:\n\n![Training](https://raw.githubusercontent.com/qiancao/hskl/main/examples/hyrank_train.png)\n\nTest image and ground truth labels:\n\n![Testing Ground Truth](https://raw.githubusercontent.com/qiancao/hskl/main/examples/hyrank_test.png)\n\nTest image and predicted labels:\n\n![Testing Prediction](https://raw.githubusercontent.com/qiancao/hskl/main/examples/hyrank_predict.png)\n\nNotes:\n1. Shape of `train` and `test` arrays are (DimX, DimY, SpectralChannels).\n2. Shape of `label` and `prediction` arrays are (DimX, DimY).\n3. Labeling convention for classifiers:\n         (a) Datatype: `label.dtype == np.uint8`.\n         (b) Labeled classes start from integer 1. Pixels with `label == 0` are ignored (masked out).\n5. Dimension(s) of `train` and `label` must be consistent: `train.shape[0] == label.shape[0]` and `train.shape[1] == label.shape[1]`.\n6. Inputs: `train`, `test`, and `label` can also be lists of `np.ndarray`s with each element satisfying the preceeding requirements.\n\n## Planned Features\n\nIn the near-term:\n* Test scripts and data\n* Grid search cross validation\n\nIn the long-term, support for:\n* Pipelines\n* Patch-based featurizer\n* Dask-enabled parallelism\n* Deep learning (PyTorch) models\n\n## Cite this Project\n\nQian Cao, Deependra Mishra, John Wang, Steven Wang, Helena Hurbon and Mikhail Berezin. HSKL:  A Machine Learning Framework For Hyperspectral Image Analysis. *Proc. IEEE WHISPERS*. IEEE, 2021.\n\n## References\n\nKarantzalos, Konstantinos, Karakizi, Christina, Kandylakis, Zacharias, \u0026 Antoniou, Georgia. (2018). HyRANK Hyperspectral Satellite Dataset I (Version v001). Zenodo. http://doi.org/10.5281/zenodo.1222202\n\nSpectral Python (SPy): https://github.com/spectralpython/spectral\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqiancao%2Fhskl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqiancao%2Fhskl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqiancao%2Fhskl/lists"}