FLUX Detection model with sklearn API using wavelets and UMAP embeddings and then K-Nearest neighbors for classification. The process is as follows: DWT -> UMAP -> KNN. The discrete wavelet transform converts an image to its wavelet representation. The model was trained on around 300 FLUX images and 300 photographs from Unsplash but a new dataset can be used instead of FLUX. Accuracy varies depending on the dataset but can be anywhere from 80%-90% depending on the dataset you use.
Methods include fit, predict, score, and predict_proba. First, load an image using PIL (Pillow) and then store using an array. Load the class using joblib and then predict. The model is already pretrained but can be trained again using fit. The images have to be resized to 512x512 before prediction, otherwise the model will give an error.
model = joblib.load("flux_classifier.pkl")
images = [Image.open("image.jpeg").resize((512, 512))]
predictions = model.predict(images)