Background: The COVID-19 pandemic has caused immense health and financial loss globally. Standard health precautions, including mask-wearing reduced its spread. Compliance with these measures varied between countries, depending on the culture, the public awareness and the policies enacted by the government. A higher rate of mask-wearing was thought to be more effective in limiting the spread of the disease and methods of monitoring mask-wearing would be useful for campaigns to increase mask-wearing. Although the mask-wearing rate has been estimated with questionnaires and episodic counting studies, there were very few reports visually documenting the rate of mask wearing sequentially over time. In the present study we developed an artificial intelligence (AI) system to analyze images from public CCTV (closed-circuit television) to document the rate of mask wearing in Bangkok, Thailand, and correlate the rate with public health policies and COVID-19 events and determine factors related to improper masking. Methodology: Public CCTV cameras in the Bangkok Metropolitan Area (BMA) were selected in view of their location and camera viewpoints. Every week, 9 hours of video clips from each of these cameras were downloaded and sent for analysis by an AI that had been trained to detect mask-wearing using pictures with and without masks from public databases. A number of the images was also visually checked for accuracy. The rate of mask-wearing was analyzed and correlated to public health measures and COVID-19 infections using panel regression analysis. The images of faces without masks were reviewed to understand factors related to not wearing masks. Results: 39 cameras were selected for weekly data download from 1 April to 15 November 2021. Of these 15 were validated fortnightly by humans. Important COVID-19 events over 8 months of the study included the announcement of the mask mandate and the peak infection of the 4th wave of infection in Thailand. The overall average rate of mask-wearing across BMA in the mobile population increased after the mask mandate from 89% (SD 10%) to 92% (SD 9%) but this did not reach statistical significance (p = 0.3). However, comparing the mask-wearing rate from the mask mandate to the start of the 4th wave, and from the start to the peak of infections of the 4th wave, the mask-wearing rate increased significantly from 92% to 96% (p = 0.0039). Statistical analysis also revealed that the reported number of infections in the prior week, weekends, time of day, and type of location were significant factors associated with the mask-wearing behavior. Analyzing the images showed that males were approximately 3 times more likely to be seen without proper masking. Conclusions: The use of public CCTV and mask-detecting AI can be used for public monitoring of mask-wearing in the real-world. Bangkokians had a high mask-wearing rate in public areas with an 89% mask-wearing rate before the mask mandate. Although mask wearing increased after the mandate to 92%, the maximal rate of mask wearing (96%) correlated with the peak infection in Bangkok. Factors related to improper masking included the reported number of infected people in the prior week, weekends, time of day, and location type. These factors, as well as other factors seen from the CCTV images may be good targets for campaigns to increase proper mask wearing in the future.