Package: datadreamer
DataDreamerQuickstartTo generate your dataset with custom classes, you need to execute only two commands:pipinstalldatadreamer
datadreamer--class_namespersonmoonrobotOverviewDataDreameris an advanced toolkit engineered to facilitate the development of edge AI models, irrespective of initial data availability. Distinctive features of DataDreamer include:Synthetic Data Generation: Eliminate the dependency on extensive datasets for AI training. DataDreamer empowers users to generate synthetic datasets from the ground up, utilizing advanced AI algorithms capable of producing high-quality, diverse images.Knowledge Extraction from Foundational Models:DataDreamerleverages the latent knowledge embedded within sophisticated, pre-trained AI models. This capability allows for the transfer of expansive understanding from these "Foundation models" to smaller, custom-built models, enhancing their capabilities significantly.Efficient and Potent Models: The primary objective ofDataDreameris to enable the creation of compact models that are both size-efficient for integration into any device and robust in performance for specialized tasks.Table of ContentsFeaturesInstallationHardware RequirementsUsageMain ParametersAdditional ParametersAvailable modelsExampleOutputAnnotations FormatNoteLimitationsLicenseAcknowledgementsFeaturesPrompt Generation: Automate the creation of image prompts using powerful language models.Provided class names: ["horse", "robot"]Generated prompt: "A photo of a horse and a robot coexisting peacefully in the midst of a serene pasture."Image Generation: Generate synthetic datasets with state-of-the-art generative models.Dataset Annotation: Leverage foundation models to label datasets automatically.Edge Model Training: Train efficient small-scale neural networks for edge deployment. (not part of this library)InstallationTo install with pip:pipinstalldatadreamerHardware RequirementsTo ensure optimal performance and compatibility with the libraries used in this project, the following hardware specifications are recommended:GPU: A CUDA-compatible GPU with a minimum of 16 GB memory. This is essential for libraries liketorch,torchvision,transformers, anddiffusers, which leverage CUDA for accelerated computing in machine learning and image processing tasks.RAM: At least 16 GB of system RAM, although more (32 GB or above) is beneficial for handling large datasets and intensive computations.UsageThedatadreamer/pipelines/generate_dataset_from_scratch.py(datadreamercommand) script is a powerful tool for generating and annotating images with specific objects. It uses advanced models to both create images and accurately annotate them with bounding boxes for designated objects.Run the following command in your terminal to use the script:datadreamer--save_dir<directory>--class_names<objects>--prompts_number<number>[additionaloptions]Main Parameters--save_dir(required): Path to the directory for saving generated images and annotations.--class_names(required): Space-separated list of object names for image generation and annotation. Example: person moon robot.--prompts_number(optional): Number of prompts to generate for each object. Defaults to 10.Additional Parameters--task: Choose betweendetectionandclassification. Default isdetection.--num_objects_range: Range of objects in a prompt. Default is 1 to 3.--prompt_generator: Choose betweensimple,lm(language model) andtiny(tiny LM). Default issimple.--image_generator: Choose image generator, e.g.,sdxlorsdxl-turbo. Default issdxl-turbo.--image_annotator: Specify the image annotator, likeowlv2. Default isowlv2.--conf_threshold: Confidence threshold for object detection. Default is 0.15.--use_tta: Toggle test time augmentation for object detection. Default is True.--enhance_class_names: Enhance class names with synonyms. Default is False.--use_image_tester: Use image tester for image generation. Default is False.--image_tester_patience: Patience level for image tester. Default is 1.--device: Choose betweencudaandcpu. Default is cuda.--seed: Set a random seed for image and prompt generation. Default is 42.Available modelsModel CategoryModel NamesDescription/NotesPrompt GenerationMistral-7B-Instruct-v0.1Semantically rich promptsTinyLlama-1.1B-Chat-v1.0Tiny LMSimple random generatorJoins randomly chosen object namesImage GenerationSDXL-1.0Slow and accurate (1024x1024 images)SDXL-TurboFast and less accurate (512x512 images)Image AnnotationOWLv2Open-Vocabulary object detectorExampledatadreamer--save_dirpath/to/save_directory--class_namespersonmoonrobot--prompts_number20--prompt_generatorsimple--num_objects_range13--image_generatorsdxl-turboThis command generates images for the specified objects, saving them and their annotations in the given directory. The script allows customization of the generation process through various parameters, adapting to different needs and hardware configurations.OutputThe dataset comprises two primary components: images and their corresponding annotations, stored as JSON files.save_dir/
│
├──image_1.jpg
├──image_2.jpg
├──...
├──image_n.jpg
├──prompts.json
└──annotations.jsonAnnotations FormatDetection Annotations (detection_annotations.json):Each entry corresponds to an image and contains bounding boxes and labels for objects in the image.Format:{"image_path":{"boxes":[[x_min,y_min,x_max,y_max],...],"labels":[label_index,...]},..."class_names":["class1","class2",...]}Classification Annotations (classification_annotations.json):Each entry corresponds to an image and contains labels for the image.Format:{"image_path":{"labels":[label_index,...]},..."class_names":["class1","class2",...]}NotePlease make sure that all dependencies are correctly installed and that the datadreamer package is properly set up in your Python environment before running the script.LimitationsWhile the datadreamer library leverages advanced Generative models to synthesize datasets and Foundation models for annotation, there are inherent limitations to consider:Incomplete Object Representation: Occasionally, the generative models might not include all desired objects in the synthetic images. This could result from the complexity of the scene or limitations within the model's learned patterns.Annotation Accuracy: The annotations created by foundation computer vision models may not always be precise. These models strive for accuracy, but like all automated systems, they are not infallible and can sometimes produce erroneous or ambiguous labels.Despite these limitations, the datasets created by datadreamer provide a valuable foundation for developing and training models, especially for edge computing scenarios where data availability is often a challenge. The synthetic and annotated data should be seen as a stepping stone, granting a significant head start in the model development process.LicenseThis project is licensed under theApache License, Version 2.0- see theLICENSEfile for details.The above license does not cover the models. Please see the license of each model in the table above.AcknowledgementsThis library was made possible by the use of several open-source projects, including Transformers, Diffusers, and others listed in the requirements.txt.SD-XL 1.0 LicenseSDXL-Turbo License