Plant microbial fuel cells (PMFCs) are an emergent green-energy technology that continuously converts solar energy into electricity. Placing PMFCs on the roofs of urban buildings can help to create green urban environments even as they generate power. The power generation performance of PMFCs is affected by a range of environmental factors, so their power generation capacity is difficult to estimate. To develop an artificial intelligence model to forecast PMFC power generation accurately, relevant results obtained using shallow and deep learning techniques are compared for the first time. Once deep learning techniques had been identified as superior for this purpose, they were used with a bio-inspired optimization algorithm to dynamically setting the model hyperparameters. The developed model can also be applied to estimate the power generation capacity of PMFC devices in the future. The model was trained using data collected from sensors in a site experiment that was carried out using PMFCs embedded with Chinese pennisetumin (Pennisetum alopecuroides), narrowleaf cattail (Typha angustifolia), dwarf rotala (Rotala rotundifolia), and no plant as a control group. The original data of device parameters, environmental parameters, and the measured power generation of PMFCs in numerical form were applied to train shallow learning and time-series deep learning models. Meanwhile, the state-of-the-art sliding window technique was used to establish a numerical matrix, which was converted into a 2D image-like format to represent inputs for deep convolutional neural network (CNN) models. The accuracy in predicting the power generation capacity of PMFC devices showed that EfficientNet, an advanced type of CNN, was the best model among the shallow and deep learning techniques. These analytical results demonstrate the superior performance of deep CNNs in learning image features and their consequent suitability for constructing PMFC power generation forecasting models. To enhance the generalization performance of CNN, a