• Ashwin Bharambe's avatar
    Prepare for python3 compatibility [2] · 9185b699
    Ashwin Bharambe authored
    Summary:
    There were two "bugs" associated with loading pickle files:
    
    The first is easy: these files should have been `open()`ed as binary, but
    weren't.
    
    The second is slightly nuanced. The default encoding used wwhile unpickling
    is 7-bit (ASCII.) However, the blobs are arbitrary 8-bit bytes which don't
    agree. The absolute correct way to do this is to use `encoding="bytes"` and
    then interpret the blob names either as ASCII, or better, as unicode utf-8. A
    reasonable fix, however, is to treat it the encoding as 8-bit latin1 (which
    agrees with the first 256 characters of Unicode anyway.)
    
    As part of this, I also centralized all pickling operations into
    `detectron.utils.io`.
    
    This /still/ does not change the build to Python3, but I believe it is ready
    now.
    
    Reviewed By: rbgirshick
    
    Differential Revision: D9689294
    
    fbshipit-source-id: add1f2d784fe196df27b20e65e35922536d11a3c
    9185b699
convert_selective_search.py 1.83 KB