Marine oil spills can damage marine ecosystems, economic development, and human health. It is important to accurately identify the type of oil spills and detect the thickness of oil films on the sea surface to obtain the amount of oil spill for on-site emergency responses and scientific decision-making. Optical remote sensing is an important method for marine oil-spill detection and identification. In this study, hyperspectral images of five types of oil spills were obtained using unmanned aerial vehicles (UAV). To address the poor spectral separability between different types of light oils and weak spectral differences in heavy oils with different thicknesses, we propose the adaptive long-term moment estimation (ALTME) optimizer, which cumulatively learns the spectral characteristics and then builds a marine oil-spill detection model based on a one-dimensional convolutional neural network. The results of the detection experiment show that the ALTME optimizer can store in memory multiple batches of long-term oil-spill spectral information, accurately identify the type of oil spills, and detect different thicknesses of oil films. The overall detection accuracy is larger than 98.09%, and the Kappa coefficient is larger than 0.970. The F1-score for the recognition of light-oil types is larger than 0.971, and the F1-score for detecting films of heavy oils with different film thicknesses is larger than 0.980. The proposed optimizer also performs well on a public hyperspectral dataset. We further carried out a feasibility study on oil-spill detection using UAV thermal infrared remote sensing technology, and the results show its potential for oil-spill detection in strong sunlight.