Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

Revision 08a8fb349e580560cdc785d0860cc423c288eca8 authored by Changjian Chen on 20 May 2024, 01:45:34 UTC, committed by Changjian Chen on 20 May 2024, 01:45:34 UTC
update README
1 parent 90f314b
  • Files
  • Changes
  • 5b23d0f
  • /
  • backend
  • /
  • data
  • /
  • __pycache__
  • /
  • __init__.cpython-37.pyc
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • revision
  • directory
  • content
revision badge
swh:1:rev:08a8fb349e580560cdc785d0860cc423c288eca8
directory badge
swh:1:dir:3d1e63d905c7651894c8c68d3b1b329c5b11741f
content badge
swh:1:cnt:9373997205df5f614c3bfe00fc8d9ddf948c5999

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • revision
  • directory
  • content
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
__init__.cpython-37.pyc
B

���_s�@s�ddlmZmZmZmZmZddlmZmZm	Z	ddl
mZmZm
Z
mZddlTddlZddlZddlZddlmZddlmZd	d
�Zdd�ZGd
d�de�Zdd�ZGdd�d�ZdS)�)�
COCODetection�COCOAnnotationTransform�COCO_CLASSES�	COCO_ROOT�
get_label_map)�COCO17Detection�COCO17_ROOT�COCO17AnnotationTransform)�VOCDetection�VOCAnnotationTransform�VOC_ROOT�VOC_CLASSES)�*�N)�Sampler)�pad_sequencecCs�g}g}g}g}xb|D]Z}|�|d�|�t�|d��|�t�|d��t|�dkr|�t�|d��qWt|�dkr�t�|d�|fSt�|d�||t�|d�fSdS)a�Custom collate fn for dealing with batches of images that have a different
    number of associated object annotations (bounding boxes).

    Arguments:
        batch: (tuple) A tuple of tensor images and lists of annotations

    Return:
        A tuple containing:
            1) (tensor) batch of images stacked on their 0 dim
            2) (list of tensors) annotations for a given image are stacked on
                                 0 dim
    rr���N)�append�torch�FloatTensor�len�stack)�batch�targetsZimgs�semis�image_level_target�sample�r�,/data/changjian/WSL/CSD-SSD/data/__init__.py�detection_collates
r!cCs�g}g}g}g}xJ|D]B}|�|d�|�|d�|�|d�|�t�|d��qWt|dd�t�|�t|dd�t�|d�fS)NrrrrT)Zbatch_first)rrrrr)rZ
text_featuresZimage_featuresrZmasksrrrr �text_collate-s
r"c@s.eZdZddd�Zdd�Zdd�Zdd	�Zd
S)�VOCBatchSamplerrcCs�t|t�std�|���t|t�s*|dkr8td�|���t|t�sPtd�|���||_||_||_||_||_	t
|||j�|_|j|j|_||_
dS)NzMsampler should be an instance of torch.utils.data.Sampler, but got sampler={}rzFbatch_size should be a positive integeral value, but got batch_size={}z9drop_last should be a boolean value, but got drop_last={})�
isinstancer�
ValueError�format�bool�sampler�
batch_size�	drop_last�super_threshold�supervise_percent�int�
supervise_num�unsupervise_num�only_supervise)�selfr(r)r*r+r,r0�batch_super_timesrrr �__init__<s$


zVOCBatchSampler.__init__cCs
||_dS)N)r0)r1r0rrr �set_only_superviseRsz"VOCBatchSampler.set_only_superviseccs
|jrVg}x0|jD]&}|�|�t|�|jkr|Vg}qWt|�dkrT|jsT|Vn�g}g}x�|jD]x}||jkr�t|�|jkr�|�|�n"||jkr�t|�|jkr�|�|�t|�|jkrft|�|jkrf||Vg}g}qfWt||�dk�r|j�s||VdS)Nr)	r0r(rrr)r*r+r/r.)r1rZidxZsuper_batchZ
unsuper_batchrrr �__iter__]s,


zVOCBatchSampler.__iter__cCs4|jrt|j�|jSt|j�|jd|jSdS)Nr)r*rr(r))r1rrr �__len__yszVOCBatchSampler.__len__N)r)�__name__�
__module__�__qualname__r3r4r5r6rrrr r#;s
r#cCs0t�|||f��tj�}||8}|�tj�}|S)N)�cv2ZresizeZastype�np�float32)�image�size�mean�xrrr �base_transform�srAc@seZdZdd�Zddd�ZdS)�
BaseTransformcCs||_tj|tjd�|_dS)N)Zdtype)r>r;�arrayr<r?)r1r>r?rrr r3�szBaseTransform.__init__NcCst||j|j�||fS)N)rAr>r?)r1r=ZboxesZlabelsrrr �__call__�szBaseTransform.__call__)NN)r7r8r9r3rDrrrr rB�srB)ZcocorrrrrZcoco17rrr	Zvocr
rrr
Zconfigrr:�numpyr;�torch.utils.datarZtorch.nn.utils.rnnrr!r"r#rArBrrrr �<module>sE
The diff you're trying to view is too large. Only the first 1000 changed files have been loaded.
Showing with 0 additions and 0 deletions (0 / 0 diffs computed)
swh spinner

Computing file changes ...

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API