Can I Train an AI Model on Photos That Show Uncovered Awrah?
Answered by Shaykh Irshaad Sedick
Question
I build software that detects people and objects in video. To train and test it, I download openly licensed photographs, none pornographic, and an automated filter removes anything indecent. Some remaining photos show women without hijab or men in shorts. No human looks at them; a program processes them, and buyers receive only the trained model’s numbers, with no images inside. Is it permitted to download and keep the photos for this? May I sell the software, or use a model that another company trained the same way? If not, must an existing model be discarded and retrained?
Answer
In the Name of Allah, the All-Merciful, the Especially Merciful.
May Allah Most High reward your care in carefully building something lawful, and bless the work. Amin.
Yes to the first two, and no to the third. The prohibition in our school is on a person looking at what he may not look at, and here no person looks. Copying and storing the files is not the making or the display of images that the texts forbid, and the fatwa you cite is a fatwa on pornography, which your pipeline already excludes. The model you sell contains no photographs, so its sale is the sale of lawful software, and nothing in it needs to be discarded.
No One Is Looking
Imam Nawawi (Allah have mercy on him) states the rule that governs this whole area: it is unlawful for a mature man to look at the nakedness of an unrelated free woman. [Nawawi, Minhaj al-Talibin, Kitab al-Nikah] Every word of that describes a human act. A program has no eyes and no religious responsibility, and a folder of files that no person opens produces no act of looking at all.
The school has even considered the image as distinct from the person. Imam Ibn Hajar al-Haytami and Imam Ramli (Allah have mercy on them) both record that looking at a woman’s likeness in something like a mirror is not unlawful, because the man has not seen her, and Imam Ibn Hajar adds the condition that no temptation or desire be feared. [Ibn Hajar al-Haytami, Tuhfat al-Muhtaj; Ramli, Nihayat al-Muhtaj] Some later scholars of Hadramawt were uneasy with that latitude, and SeekersGuidance counsels that the rules of looking apply to pictures and screens. You do not need that disagreement settled, since your process removes the human viewer altogether. The moment a person reviews these images, the ordinary rule of looking governs him, and your workflow should be built so that this does not happen, and Allah knows best.
Copying and Keeping the Files
Two things are forbidden in the texts on images. The first is making an image of animate life. Imam Nawawi records that our scholars and others held this to be gravely unlawful, and that the ruling of keeping an image is different: what is hung on a wall or worn is prohibited, while what is trodden on or otherwise held in no honor is not. [Nawawi, Sharh Sahih Muslim]
Neither reaches your case. Downloading a photograph creates no new form; a recognized position among the Shafiʿis of Tarim, from the late Mufti Salim Baghithan, holds that even the camera is not the prohibited image making, since the prohibition is bringing into being a form that did not exist, and duplicating a file is further from that still. As for keeping them, a dataset on a drive that no one views and that is never displayed is the opposite of an image hung in honor.
The Fatwa You Mention
Fatwa MUI 287 of 2001 is titled and scoped as a fatwa on pornography, meaning material that arouses desire. Within that scope, it declares reproducing, distributing, selling, buying, and viewing images of uncovered nakedness unlawful, and it separately permits what the Sacred Law justifies. You have already removed swimwear, underwear, and nudity; no one views what remains, and nothing is distributed. Read in its own terms, the fatwa is addressed to a different activity from yours. Respect it by keeping your filter strict and your dataset private.
The Default Ruling and the Sale
Imam Suyuti (Allah have mercy on him) says, “the default in things is permissibility until evidence establishes prohibition.” [Suyuti, al-Ashbah wa al-Nazaʾir] Software that detects people and objects in videos is a lawful product, and Allah knows best.
The sale follows. What the buyer receives is a set of numbers with no photographs in it, so the object of sale is lawful, and the price is clean. Our school holds that even where something disliked or unlawful attends a transaction from outside, the contract itself stands, as with the sale of grapes to one who will press wine. [Nawawi, al-Majmuʿ Sharh al-Muhadhdhab; Zakariyya al-Ansari, Asna al-Matalib] Using a model another company trained on similar data is permitted for the same reason and with less involvement on your part.
Nothing Needs Retraining
Since no prohibited act took place and the model contains nothing prohibited, there is nothing to discard. Even if a wrong had occurred somewhere upstream, the remedy in our school is repentance for the act, and what was lawfully built afterward is not torn down on its account.
Keeping It That Way
You can keep the automated filter and keep it conservative. If a human ever has to check samples for quality, build that step on blurred or cropped images, or on photos of covered subjects, so that no one on your team is tested by that which Sacred Law tells him to lower his gaze from. Delete datasets when a project ends; don’t publish any of them; and sell the software for what it is: finding people and objects in footage.
If you feel a pull toward greater caution, training on datasets curated for covered subjects is a fine choice where the technology allows it, and there is reward in it. It is not required of you.
And Allah Most High knows best.
Shaykh Irshaad Sedick
Related Answers
- Is It Haram to Make AI Images or Advertise an AI Image Generator? — Making AI images is not unlawful in itself; the ruling follows what is made and shown, not the tool.
- Do the Rulings of Looking Apply to Pictures and Television? — Deliberately viewing what is unlawful to look at remains forbidden, whether it appears in print or on a screen.
- What Is the Ruling on Photographing, Filming, and Drawing Animate Life? — Scholars differ on photography itself, with a stricter and a more permissive position, apart from the ruling on hand-drawn images.
- What Is the Ruling on Photography? Does Islam Forbid It? — Scholars differ on photography, some permitting it as a captured likeness rather than a drawn one, others are more cautious.
Shaykh Irshaad Sedick was raised in South Africa in a traditional Muslim family. He graduated from Dar al-Ulum al-Arabiyyah al-Islamiyyah in Strand, Western Cape, under the guidance of the late world-renowned scholar Shaykh Taha Karaan. Shaykh Irshaad received Ijaza from many luminaries of the Islamic world, including Shaykh Taha Karaan, Mawlana Yusuf Karaan, and Mawlana Abdul Hafeez Makki, among others. He is the author of the text “The Musnad of Ahmad ibn Hanbal: A Hujjah or not?” He has served as the Director of the Discover Islam Centre and Al Jeem Foundation. For the last five years till present, he has served as the Khatib of Masjid Ar-Rashideen, Mowbray, Cape Town. Shaykh Irshaad has thirteen years of teaching experience at some of the leading Islamic institutes in Cape Town. He is currently building an Islamic online learning and media platform called ‘Isnad Academy’ and has completed his Master’s degree in the study of Islam at the University of Johannesburg. He has a keen interest in healthy living and fitness.