To prepare the software, download and install Anaconda from its official website. Launch the PyCharm IDE program. Then open the Anaconda prompt command line and type conda create n pytorch python=3.8 to create a new Conda environment.
After the environment is created, enter conda info envs to confirm that the PyTorch environment exists. Open the Anaconda prompt and activate the PyTorch environment by entering conda activate pytorch. type nvidia-smi to check the current compute unified device architecture, or CUDA, version, then install PyTorch version 1.8.1 by running the command conda install pytorch=1.8.1 torchvision=0.9.1 torchaudio=0.8.1 cudatoolkit=11.0 c pytorch.
To run the model recognition, pre-process the images to prepare them for model input. Using the displayed code, resize the images from 280 by 280 pixels to 224 by 224 pixels, and normalize them to ensure they meet the model size requirements. Train a multi-class recognition model with the already created dataset by setting the number of iterations to 200 and an initial learning rate of 0.0001.
Reduce the learning rate by a third every 10 iterations with a batch size of 64. Save the optimal model parameters automatically after each iteration. Right-click and press run script.
Then employ a meticulously trained recognition model and systematically traverse the original image for identification purposes. Configure horizontal and vertical steps precisely at 280 pixels to result in the generation of a comprehensive distribution map, highlighting the presence of invasive flora within the boundaries of the study area. Present the selected results visually.
Perform simple data augmentation with a random resized crop and random horizontal flip functions. To extend the image set and extract the six vegetation indices. To ensure precise estimation of the biomass of invasive plants, create a K-nearest neighbor regression model using the output and the extracted vegetation indices as inputs Mikania micrantha could be observed climbing atop the plant adorned with white flowers, the other plants, as well as the road, and accompanying elements were uniformly depicted in the background.
The model recognized the red part as Mikania micrantha, demonstrating robust detection in complex backgrounds. The regression analysis demonstrated strong predictive performance with an R squared value of 0.62 and an RMSE of 10.56 grams per square meter. The model enhanced the accuracy of chamomile biomass estimation, and the spatial distribution map effectively captured the distribution of chamomile biomass.