This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | from rest_framework import serializers, exceptions | |
| class DynamicFieldSerializerMixin(serializers.Serializer): | |
| """ | |
| 动态指定保留字段 | |
| """ | |
| expose_all_possible_fields = True | |
| def __init__(self, *args, **kwargs): | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class PairRandomCrop: | |
| """Crop the given PIL.Image at a random location. | |
| ** This is a MODIFIED version **, which supports identical random crop for | |
| both image and target map in Semantic Segmentation. | |
| Args: | |
| size (sequence or int): Desired output size of the crop. If size is an | |
| int instead of sequence like (h, w), a square crop (size, size) is | |
| made. | |
| padding (int or sequence, optional): Optional padding on each border | |
| of the image. Default is 0, i.e no padding. If a sequence of length |