1. Pretrain the stroke encoder and the sequence decoder.
    python -u Train.py
    python -u Inference.py

2. Train the diffusion model.
   python -u Diffussion_Train.py

(We have provided all the pretrained models in the "model_save" file.)

3. Construct the stroke gallery.
   python -u Dataset.py
   python -u save_embedding.py

4. Editing sketch
    Select the to be edited sketch and the target stroke from the "stroke" file. 
    Then, "python -u Replace.py".

    The parameters in "Replace.py" are followings:

    sketch_idx = 7886  # to be edited sketch
    sketch_stroke_idx = [3] # to be edited strokes
    template_idx =8196 # referenced sketch
    template_stroke_idx = [4] # referenced strokes from referenced sketch

  Don't forget to download the subset of QuickDraw and storage it in the "dataset" file.
（"airplane.npz", "angel.npz", "alarm clock.npz", "apple.npz", "butterfly.npz", "belt.npz", "bus.npz",
   "cake.npz", "cat.npz", "clock.npz", "eye.npz", "fish.npz",
   "pig.npz", "sheep.npz", "spider.npz", "The Great Wall of China.npz", "umbrella.npz"）