This AI-powered app helps students and nature enthusiasts identify and explore tree species based on image, location, and tree attributes.
π² Recommend Trees by Location
- Input GPS coordinates (latitude, longitude)
- Specify tree diameter, native status, city, and state
- Returns the top 5 tree species likely found in that area
π Find Locations for a Tree
- Choose a tree species from a dropdown
- Displays cities and states where the species is most commonly found
π· Identify Tree from Image
- Upload an image of a tree
- CNN model predicts the species
- If found in the dataset, shows common locations for that species
ποΈ Tree Metadata
- Source: Open tree surveys from multiple cities (e.g., Louisville, Chicago)
- Total records: ~1.38 million
- Key columns:
common_name: Tree species (e.g., Bur Oak)scientific_name: Botanical name (e.g., Quercus macrocarpa)latitude_coordinate,longitude_coordinatecity,state,addressnative: Whether the tree is native to the areadiameter_breast_height_CM: Tree height/width measure
πΌοΈ Tree Image Dataset
- Structure: Folder-based, each folder named after a tree species
- Use: Used to train the CNN for species recognition
- Preprocessing:
- Images resized to 224x224
- Normalized pixel values
- Augmented with flips, zoom, and rotation
π Recommender System
- Algorithm: K-Nearest Neighbors (KNN)
- Library:
sklearn.neighbors.NearestNeighbors - Inputs: location, diameter, native status, city/state
- Output: Most common tree species nearby
π§ CNN Classifier
- Model: Sequential CNN (Conv2D + MaxPooling + Dense layers)
- Library:
tensorflow.keras - Input: 224x224 image
- Output: Predicted tree species with probability
- Loss: Categorical Crossentropy
- Optimizer: Adam
π Preprocessing & Encoding
- Categorical Encoding: LabelEncoder
- Scaling: StandardScaler for lat/lon/diameter
- Data Splits: 80% training, 20% validation
-
Run
5M_trees.ipynbto train the recommender and save:tree_data.pklscaler.joblibnn_model.joblib
-
Run
tree_CNN.ipynbto train the image classifier and save:basic_cnn_tree_species.h5
-
Launch the app:
streamlit run streamlit_integrated.py