Metadata-Version: 2.4
Name: FogVision
Version: 0.1.2
Summary: Fog prediction from images using deep learning
Author: Joel Nicolow
License: MIT License
        
        Copyright (c) 2024 Joel Nicolow
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
        Attribution Requirement:
        
        In all cases, any published or distributed work that incorporates, references, 
        or is derived from this Software must include proper attribution to the original 
        author(s) and the Software by including a citation or link to the original
        source code repository.
         
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Scientific/Engineering :: Image Recognition
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: torch>=2.5.0
Requires-Dist: torchvision>=0.20.0
Requires-Dist: numpy>=2.2
Requires-Dist: pandas>=2.2
Requires-Dist: scikit-learn>=1.6
Requires-Dist: matplotlib>=3.10
Requires-Dist: matplotlib-inline>=0.1.6
Requires-Dist: seaborn>=0.13
Requires-Dist: pillow>=11.0
Requires-Dist: joblib>=1.4
Requires-Dist: ipython>=9.10
Requires-Dist: ipykernel>=6.29.5
Dynamic: license-file

# FogVision
[![Last Commit](https://img.shields.io/github/last-commit/jnicolow/FogVision)](
https://github.com/jnicolow/FogVision/commits/)
![GitHub issues](https://img.shields.io/github/issues/jnicolow/FogVision)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
![GitHub commit activity](https://img.shields.io/github/commit-activity/y/jnicolow/FogVision)

FogVision is an open-source Python framework for classifying mountain trail camera imagery by fog presence. First, image embeddings are computed using a pretrained ResNet50 model, and then a classification head was trained on ~40k images from 30 sites (separate classification head for diurnal and nocturnal imagery).

FogVision can be installed either at the Python Package Index (PyPI) or through the command line. It can then be utilized, either with Jupyter Notebook or from the command-line to perform inferences on images.

## Installation
The source code can be found on GitHub at: https://github.com/jnicolow/FogVision/

FogVision is installable at the [Python Package Index (PyPI)](https://pypi.org/project/FogVision/).
```
pip install fogvision
```

## Classify function
When using FogVision, you can use the `classify` function in a .ipynb file (Jupyter Notebook) to classify your images.
```
from fogvision import fv

fv.classify(image_folder, plot_image=False, save_csv_to=None, sitename=None, crop_size=None, random_crop=False, threshold=0.5)
```
Only *image_folder* is needed to run the function properly.
- **image_folder** (str): The folder path which contains the images to be classified.
- **plot_image** (bool): Determines whether or not an image is plotted or not. Default set to false.
- **save-csv-to** (str): Allows for a path to save the .csv file to, instead of the images folder.
- **sitename**: Allows for manual setting of the site name.
- **crop-size** (int): The side length (in pixels) of the square crop that is fed into the model. It controls how big the tensor is. If nothing is passed, then it chooses the largest square that fits in the image, rounded down to a multiple of 32.
- **random-crop** (bool): If false, the center square is always taken. If true, then a randomly positioned square is taken. Default set to false.
- **threshold** (int): By default, the threshold is 0.5. This means that if the inference value for the image is >= 0.5, then fog_val will be 1, but if it's less than 0.5, then fog_val will be 0. This option changes the threshold of the fog_val.

## CLI Tool
FogVision can also be used in the command line using `fogvision`. Since images cannot be plotted in a command line, the original *plot_image* parameter is not included and set to false by default.
```
fogvision path/to/images

--save-csv-to (str)
--sitename
--crop-size (int)
--random-crop (bool)
--threshold (int)
```
